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

Member Typedef Documentation

◆ ChildIteratorType

Definition at line 384 of file IRGraph.cpp.

◆ NodeType

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

459 {
460 std::string str;
461 std::stringstream rawstr(str);
462
463 rawstr << "shape=record";
464
465 const SVFStmt* edge = *(EI.getCurrent());
466 assert(edge && "No edge found!!");
467 if (SVFUtil::isa<AddrStmt>(edge))
468 {
469 rawstr << ",color=green";
470 }
471 else if (SVFUtil::isa<CopyStmt>(edge))
472 {
473 rawstr << ",color=black";
474 }
475 else if (SVFUtil::isa<GepStmt>(edge))
476 {
477 rawstr << ",color=\"purple:purple\"";
478 }
479 else if (SVFUtil::isa<StoreStmt>(edge))
480 {
481 rawstr << ",color=blue";
482 }
483 else if (SVFUtil::isa<LoadStmt>(edge))
484 {
485 rawstr << ",color=red";
486 }
487 else if (SVFUtil::isa<PhiStmt>(edge))
488 {
489 rawstr << ",color=grey";
490 }
491 else if (SVFUtil::isa<SelectStmt>(edge))
492 {
493 rawstr << ",color=grey";
494 }
495 else if (SVFUtil::isa<CmpStmt>(edge))
496 {
497 rawstr << ",color=grey";
498 }
499 else if (SVFUtil::isa<BinaryOPStmt>(edge))
500 {
501 rawstr << ",color=grey";
502 }
503 else if (SVFUtil::isa<UnaryOPStmt>(edge))
504 {
505 rawstr << ",color=grey";
506 }
507 else if (SVFUtil::isa<BranchStmt>(edge))
508 {
509 rawstr << ",color=grey";
510 }
511 else if (SVFUtil::isa<TDForkPE>(edge))
512 {
513 rawstr << ",color=Turquoise";
514 }
515 else if (SVFUtil::isa<TDJoinPE>(edge))
516 {
517 rawstr << ",color=Turquoise";
518 }
519 else if (SVFUtil::isa<CallPE>(edge))
520 {
521 rawstr << ",color=black,style=dashed";
522 }
523 else if (SVFUtil::isa<RetPE>(edge))
524 {
525 rawstr << ",color=black,style=dotted";
526 }
527 else
528 {
529 assert(false && "No such kind edge!!");
530 }
531
532 return rawstr.str();
533 }
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 536 of file IRGraph.cpp.

537 {
538 const SVFStmt* edge = *(EI.getCurrent());
539 assert(edge && "No edge found!!");
540 if(const CallPE* calledge = SVFUtil::dyn_cast<CallPE>(edge))
541 {
542 return calledge->getFunEntryICFGNode()->getSourceLoc();
543 }
544 else if(const RetPE* retedge = SVFUtil::dyn_cast<RetPE>(edge))
545 {
546 return retedge->getCallSite()->getSourceLoc();
547 }
548 return "";
549 }

◆ getGraphName()

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

Return name of the graph.

Definition at line 391 of file IRGraph.cpp.

392 {
393 return graph->getGraphName();
394 }
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 420 of file IRGraph.cpp.

421 {
422 if (SVFUtil::isa<ValVar>(node))
423 {
424 if(SVFUtil::isa<GepValVar>(node))
425 return "shape=hexagon";
426 else if (SVFUtil::isa<DummyValVar>(node))
427 return "shape=diamond";
428 else
429 return "shape=box";
430 }
431 else if (SVFUtil::isa<ObjVar>(node))
432 {
433 if(SVFUtil::isa<GepObjVar>(node))
434 return "shape=doubleoctagon";
435 else if(SVFUtil::isa<BaseObjVar>(node))
436 return "shape=box3d";
437 else if (SVFUtil::isa<DummyObjVar>(node))
438 return "shape=tab";
439 else
440 return "shape=component";
441 }
442 else if (SVFUtil::isa<RetValPN>(node))
443 {
444 return "shape=Mrecord";
445 }
446 else if (SVFUtil::isa<VarArgValPN>(node))
447 {
448 return "shape=octagon";
449 }
450 else
451 {
452 assert(0 && "no such kind!!");
453 }
454 return "";
455 }

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

407 {
408 std::string str;
409 std::stringstream rawstr(str);
410 // print function info
411 if (node->getFunction())
412 rawstr << "[" << node->getFunction()->getName() << "] ";
413
414 rawstr << node->toString();
415
416 return rawstr.str();
417
418 }
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 398 of file IRGraph.cpp.

399 {
400 if (Options::ShowHiddenNode()) return false;
401 else return node->isIsolatedNode();
402 }
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: