Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SVF::DOTGraphTraits< IRGraph * > Struct Reference
Inheritance diagram for SVF::DOTGraphTraits< IRGraph * >:
SVF::DefaultDOTGraphTraits

Public Types

typedef SVFVar NodeType
 
typedef NodeType::iterator ChildIteratorType
 

Public Member Functions

 DOTGraphTraits (bool isSimple=false)
 
- Public Member Functions inherited from SVF::DefaultDOTGraphTraits
 DefaultDOTGraphTraits (bool simple=false)
 
template<typename GraphType >
std::string getNodeLabel (const void *, const GraphType &)
 

Static Public Member Functions

static std::string getGraphName (IRGraph *graph)
 Return name of the graph. More...
 
static bool isNodeHidden (SVFVar *node, IRGraph *)
 
static std::string getNodeLabel (SVFVar *node, IRGraph *)
 
static std::string getNodeAttributes (SVFVar *node, IRGraph *)
 
template<class EdgeIter >
static std::string getEdgeAttributes (SVFVar *, EdgeIter EI, IRGraph *)
 
template<class EdgeIter >
static std::string getEdgeSourceLabel (SVFVar *, EdgeIter EI)
 
- Static Public Member Functions inherited from SVF::DefaultDOTGraphTraits
template<typename GraphType >
static std::string getGraphName (const GraphType &)
 
template<typename GraphType >
static std::string getGraphProperties (const GraphType &)
 
static bool renderGraphFromBottomUp ()
 
template<typename GraphType >
static bool isNodeHidden (const void *, const GraphType &)
 
template<typename GraphType >
static std::string getNodeIdentifierLabel (const void *, const GraphType &)
 
template<typename GraphType >
static std::string getNodeDescription (const void *, const GraphType &)
 
template<typename GraphType >
static std::string getNodeAttributes (const void *, const GraphType &)
 
template<typename EdgeIter , typename GraphType >
static std::string getEdgeAttributes (const void *, EdgeIter, const GraphType &)
 
template<typename EdgeIter >
static std::string getEdgeSourceLabel (const void *, EdgeIter)
 
template<typename EdgeIter >
static bool edgeTargetsEdgeSource (const void *, EdgeIter)
 
template<typename EdgeIter >
static EdgeIter getEdgeTarget (const void *, EdgeIter I)
 
static bool hasEdgeDestLabels ()
 
static unsigned numEdgeDestLabels (const void *)
 
static std::string getEdgeDestLabel (const void *, unsigned)
 
template<typename GraphType , typename GraphWriter >
static void addCustomGraphFeatures (const GraphType &, GraphWriter &)
 

Additional Inherited Members

- Protected Member Functions inherited from SVF::DefaultDOTGraphTraits
bool isSimple ()
 

Detailed Description

Write value flow graph into dot file for debugging

Definition at line 122 of file IRGraph.cpp.

Member Typedef Documentation

◆ ChildIteratorType

Definition at line 126 of file IRGraph.cpp.

◆ NodeType

Definition at line 125 of file IRGraph.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

SVF::DOTGraphTraits< IRGraph * >::DOTGraphTraits ( bool  isSimple = false)
inline

Definition at line 127 of file IRGraph.cpp.

127  :
129  {
130  }
DefaultDOTGraphTraits(bool simple=false)

Member Function Documentation

◆ getEdgeAttributes()

template<class EdgeIter >
static std::string SVF::DOTGraphTraits< IRGraph * >::getEdgeAttributes ( SVFVar ,
EdgeIter  EI,
IRGraph  
)
inlinestatic

Definition at line 200 of file IRGraph.cpp.

201  {
202  const SVFStmt* edge = *(EI.getCurrent());
203  assert(edge && "No edge found!!");
204  if (SVFUtil::isa<AddrStmt>(edge))
205  {
206  return "color=green";
207  }
208  else if (SVFUtil::isa<CopyStmt>(edge))
209  {
210  return "color=black";
211  }
212  else if (SVFUtil::isa<GepStmt>(edge))
213  {
214  return "color=purple";
215  }
216  else if (SVFUtil::isa<StoreStmt>(edge))
217  {
218  return "color=blue";
219  }
220  else if (SVFUtil::isa<LoadStmt>(edge))
221  {
222  return "color=red";
223  }
224  else if (SVFUtil::isa<PhiStmt>(edge))
225  {
226  return "color=grey";
227  }
228  else if (SVFUtil::isa<SelectStmt>(edge))
229  {
230  return "color=grey";
231  }
232  else if (SVFUtil::isa<CmpStmt>(edge))
233  {
234  return "color=grey";
235  }
236  else if (SVFUtil::isa<BinaryOPStmt>(edge))
237  {
238  return "color=grey";
239  }
240  else if (SVFUtil::isa<UnaryOPStmt>(edge))
241  {
242  return "color=grey";
243  }
244  else if (SVFUtil::isa<BranchStmt>(edge))
245  {
246  return "color=grey";
247  }
248  else if (SVFUtil::isa<TDForkPE>(edge))
249  {
250  return "color=Turquoise";
251  }
252  else if (SVFUtil::isa<TDJoinPE>(edge))
253  {
254  return "color=Turquoise";
255  }
256  else if (SVFUtil::isa<CallPE>(edge))
257  {
258  return "color=black,style=dashed";
259  }
260  else if (SVFUtil::isa<RetPE>(edge))
261  {
262  return "color=black,style=dotted";
263  }
264 
265  assert(false && "No such kind edge!!");
266  exit(1);
267  }

◆ getEdgeSourceLabel()

template<class EdgeIter >
static std::string SVF::DOTGraphTraits< IRGraph * >::getEdgeSourceLabel ( SVFVar ,
EdgeIter  EI 
)
inlinestatic

Definition at line 270 of file IRGraph.cpp.

271  {
272  const SVFStmt* edge = *(EI.getCurrent());
273  assert(edge && "No edge found!!");
274  if(const CallPE* calledge = SVFUtil::dyn_cast<CallPE>(edge))
275  {
276  return calledge->getCallSite()->getSourceLoc();
277  }
278  else if(const RetPE* retedge = SVFUtil::dyn_cast<RetPE>(edge))
279  {
280  return retedge->getCallSite()->getSourceLoc();
281  }
282  return "";
283  }

◆ getGraphName()

static std::string SVF::DOTGraphTraits< IRGraph * >::getGraphName ( IRGraph graph)
inlinestatic

Return name of the graph.

Definition at line 133 of file IRGraph.cpp.

134  {
135  return graph->getGraphName();
136  }
std::string getGraphName() const
Return graph name.
Definition: IRGraph.h:216

◆ getNodeAttributes()

static std::string SVF::DOTGraphTraits< IRGraph * >::getNodeAttributes ( SVFVar node,
IRGraph  
)
inlinestatic

Definition at line 162 of file IRGraph.cpp.

163  {
164  if (SVFUtil::isa<ValVar>(node))
165  {
166  if(SVFUtil::isa<GepValVar>(node))
167  return "shape=hexagon";
168  else if (SVFUtil::isa<DummyValVar>(node))
169  return "shape=diamond";
170  else
171  return "shape=box";
172  }
173  else if (SVFUtil::isa<ObjVar>(node))
174  {
175  if(SVFUtil::isa<GepObjVar>(node))
176  return "shape=doubleoctagon";
177  else if(SVFUtil::isa<FIObjVar>(node))
178  return "shape=box3d";
179  else if (SVFUtil::isa<DummyObjVar>(node))
180  return "shape=tab";
181  else
182  return "shape=component";
183  }
184  else if (SVFUtil::isa<RetPN>(node))
185  {
186  return "shape=Mrecord";
187  }
188  else if (SVFUtil::isa<VarArgPN>(node))
189  {
190  return "shape=octagon";
191  }
192  else
193  {
194  assert(0 && "no such kind!!");
195  }
196  return "";
197  }

◆ getNodeLabel()

static std::string SVF::DOTGraphTraits< IRGraph * >::getNodeLabel ( SVFVar node,
IRGraph  
)
inlinestatic

Return label of a VFG node with two display mode Either you can choose to display the name of the value or the whole instruction

Definition at line 148 of file IRGraph.cpp.

149  {
150  std::string str;
151  std::stringstream rawstr(str);
152  // print function info
153  if (node->getFunction())
154  rawstr << "[" << node->getFunction()->getName() << "] ";
155 
156  rawstr << node->toString();
157 
158  return rawstr.str();
159 
160  }
const char *const string
Definition: cJSON.h:172
const std::string & getName() const
Definition: SVFValue.h:243
virtual const SVFFunction * getFunction() const
Return the function that this SVFVar resides in. Return nullptr if it is a global or constantexpr nod...
Definition: SVFVariables.h:122
virtual const std::string toString() const

◆ isNodeHidden()

static bool SVF::DOTGraphTraits< IRGraph * >::isNodeHidden ( SVFVar node,
IRGraph  
)
inlinestatic

isNodeHidden - If the function returns true, the given node is not displayed in the graph

Definition at line 140 of file IRGraph.cpp.

141  {
142  if (Options::ShowHiddenNode()) return false;
143  else return node->isIsolatedNode();
144  }
static const Option< bool > ShowHiddenNode
Definition: Options.h:228
bool isIsolatedNode() const
Whether this is an isolated node on the SVFIR graph.

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