Static Value-Flow Analysis
Loading...
Searching...
No Matches
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.
 
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 363 of file IRGraph.cpp.

Member Typedef Documentation

◆ ChildIteratorType

Definition at line 367 of file IRGraph.cpp.

◆ NodeType

Definition at line 366 of file IRGraph.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

Member Function Documentation

◆ getEdgeAttributes()

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

Definition at line 441 of file IRGraph.cpp.

442 {
443 const SVFStmt* edge = *(EI.getCurrent());
444 assert(edge && "No edge found!!");
445 if (SVFUtil::isa<AddrStmt>(edge))
446 {
447 return "color=green";
448 }
449 else if (SVFUtil::isa<CopyStmt>(edge))
450 {
451 return "color=black";
452 }
453 else if (SVFUtil::isa<GepStmt>(edge))
454 {
455 return "color=purple";
456 }
457 else if (SVFUtil::isa<StoreStmt>(edge))
458 {
459 return "color=blue";
460 }
461 else if (SVFUtil::isa<LoadStmt>(edge))
462 {
463 return "color=red";
464 }
465 else if (SVFUtil::isa<PhiStmt>(edge))
466 {
467 return "color=grey";
468 }
469 else if (SVFUtil::isa<SelectStmt>(edge))
470 {
471 return "color=grey";
472 }
473 else if (SVFUtil::isa<CmpStmt>(edge))
474 {
475 return "color=grey";
476 }
477 else if (SVFUtil::isa<BinaryOPStmt>(edge))
478 {
479 return "color=grey";
480 }
481 else if (SVFUtil::isa<UnaryOPStmt>(edge))
482 {
483 return "color=grey";
484 }
485 else if (SVFUtil::isa<BranchStmt>(edge))
486 {
487 return "color=grey";
488 }
489 else if (SVFUtil::isa<TDForkPE>(edge))
490 {
491 return "color=Turquoise";
492 }
493 else if (SVFUtil::isa<TDJoinPE>(edge))
494 {
495 return "color=Turquoise";
496 }
497 else if (SVFUtil::isa<CallPE>(edge))
498 {
499 return "color=black,style=dashed";
500 }
501 else if (SVFUtil::isa<RetPE>(edge))
502 {
503 return "color=black,style=dotted";
504 }
505
506 assert(false && "No such kind edge!!");
507 exit(1);
508 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ getEdgeSourceLabel()

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

Definition at line 511 of file IRGraph.cpp.

512 {
513 const SVFStmt* edge = *(EI.getCurrent());
514 assert(edge && "No edge found!!");
515 if(const CallPE* calledge = SVFUtil::dyn_cast<CallPE>(edge))
516 {
517 return calledge->getCallSite()->getSourceLoc();
518 }
519 else if(const RetPE* retedge = SVFUtil::dyn_cast<RetPE>(edge))
520 {
521 return retedge->getCallSite()->getSourceLoc();
522 }
523 return "";
524 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 374 of file IRGraph.cpp.

375 {
376 return graph->getGraphName();
377 }
std::string getGraphName() const
Return graph name.
Definition IRGraph.h:344

◆ getNodeAttributes()

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

Definition at line 403 of file IRGraph.cpp.

404 {
405 if (SVFUtil::isa<ValVar>(node))
406 {
407 if(SVFUtil::isa<GepValVar>(node))
408 return "shape=hexagon";
409 else if (SVFUtil::isa<DummyValVar>(node))
410 return "shape=diamond";
411 else
412 return "shape=box";
413 }
414 else if (SVFUtil::isa<ObjVar>(node))
415 {
416 if(SVFUtil::isa<GepObjVar>(node))
417 return "shape=doubleoctagon";
418 else if(SVFUtil::isa<BaseObjVar>(node))
419 return "shape=box3d";
420 else if (SVFUtil::isa<DummyObjVar>(node))
421 return "shape=tab";
422 else
423 return "shape=component";
424 }
425 else if (SVFUtil::isa<RetValPN>(node))
426 {
427 return "shape=Mrecord";
428 }
429 else if (SVFUtil::isa<VarArgValPN>(node))
430 {
431 return "shape=octagon";
432 }
433 else
434 {
435 assert(0 && "no such kind!!");
436 }
437 return "";
438 }

◆ 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 389 of file IRGraph.cpp.

390 {
391 std::string str;
392 std::stringstream rawstr(str);
393 // print function info
394 if (node->getFunction())
395 rawstr << "[" << node->getFunction()->getName() << "] ";
396
397 rawstr << node->toString();
398
399 return rawstr.str();
400
401 }
virtual const std::string & getName() const
Definition SVFValue.h:186
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
virtual const std::string toString() const
Get string representation.

◆ 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 381 of file IRGraph.cpp.

382 {
383 if (Options::ShowHiddenNode()) return false;
384 else return node->isIsolatedNode();
385 }
static const Option< bool > ShowHiddenNode
Definition Options.h:225
virtual bool isIsolatedNode() const
Check if this node is isolated (no edges) in the SVFIR graph.

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