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 NodeT , typename GraphType >
std::string getNodeLabel (NodeT, 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 NodeT >
static const void * getNodeIdentifier (NodeT N)
 
template<typename NodeT , typename GraphType >
static bool isNodeHidden (NodeT, const GraphType &)
 
template<typename NodeT , typename GraphType >
static std::string getNodeIdentifierLabel (NodeT, const GraphType &)
 
template<typename NodeT , typename GraphType >
static std::string getNodeDescription (NodeT, const GraphType &)
 
template<typename NodeT , typename GraphType >
static std::string getNodeAttributes (NodeT, const GraphType &)
 
template<typename NodeT , typename EdgeIter , typename GraphType >
static std::string getEdgeAttributes (NodeT, EdgeIter, const GraphType &)
 
template<typename NodeT , typename EdgeIter >
static std::string getEdgeSourceLabel (NodeT, EdgeIter)
 
template<typename NodeT , typename EdgeIter >
static bool edgeTargetsEdgeSource (NodeT, EdgeIter)
 
template<typename NodeT , typename EdgeIter >
static EdgeIter getEdgeTarget (NodeT, EdgeIter I)
 
static bool hasEdgeDestLabels ()
 
template<typename NodeT >
static unsigned numEdgeDestLabels (NodeT)
 
template<typename NodeT >
static std::string getEdgeDestLabel (NodeT, 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 367 of file IRGraph.cpp.

Member Typedef Documentation

◆ ChildIteratorType

Definition at line 371 of file IRGraph.cpp.

◆ NodeType

Definition at line 370 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 445 of file IRGraph.cpp.

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

◆ getEdgeSourceLabel()

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

Definition at line 523 of file IRGraph.cpp.

524 {
525 const SVFStmt* edge = *(EI.getCurrent());
526 assert(edge && "No edge found!!");
527 if(const CallPE* calledge = SVFUtil::dyn_cast<CallPE>(edge))
528 {
529 return calledge->getFunEntryICFGNode()->getSourceLoc();
530 }
531 else if(const RetPE* retedge = SVFUtil::dyn_cast<RetPE>(edge))
532 {
533 return retedge->getCallSite()->getSourceLoc();
534 }
535 return "";
536 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 378 of file IRGraph.cpp.

379 {
380 return graph->getGraphName();
381 }
std::string getGraphName() const
Return graph name.
Definition IRGraph.h:342

◆ getNodeAttributes()

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

Definition at line 407 of file IRGraph.cpp.

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

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

394 {
395 std::string str;
396 std::stringstream rawstr(str);
397 // print function info
398 if (node->getFunction())
399 rawstr << "[" << node->getFunction()->getName() << "] ";
400
401 rawstr << node->toString();
402
403 return rawstr.str();
404
405 }
virtual const std::string & getName() const
Definition SVFValue.h:184
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 385 of file IRGraph.cpp.

386 {
387 if (Options::ShowHiddenNode()) return false;
388 else return node->isIsolatedNode();
389 }
static const Option< bool > ShowHiddenNode
Definition Options.h:218
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: