SVF
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::DOTGraphTraits< PAG * > Struct Template Reference
Inheritance diagram for llvm::DOTGraphTraits< PAG * >:

Public Types

typedef PAGNode NodeType
 
typedef NodeType::iterator ChildIteratorType
 

Public Member Functions

 DOTGraphTraits (bool isSimple=false)
 

Static Public Member Functions

static std::string getGraphName (PAG *graph)
 Return name of the graph. More...
 
static bool isNodeHidden (PAGNode *node)
 
static std::string getNodeLabel (PAGNode *node, PAG *)
 
static std::string getNodeAttributes (PAGNode *node, PAG *)
 
template<class EdgeIter >
static std::string getEdgeAttributes (PAGNode *, EdgeIter EI, PAG *)
 
template<class EdgeIter >
static std::string getEdgeSourceLabel (PAGNode *, EdgeIter EI)
 

Detailed Description

template<>
struct llvm::DOTGraphTraits< PAG * >

Write value flow graph into dot file for debugging

Definition at line 1108 of file PAG.cpp.

Member Typedef Documentation

◆ ChildIteratorType

typedef NodeType::iterator llvm::DOTGraphTraits< PAG * >::ChildIteratorType

Definition at line 1112 of file PAG.cpp.

◆ NodeType

typedef PAGNode llvm::DOTGraphTraits< PAG * >::NodeType

Definition at line 1111 of file PAG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

llvm::DOTGraphTraits< PAG * >::DOTGraphTraits ( bool  isSimple = false)
inline

Definition at line 1113 of file PAG.cpp.

1113  :
1114  DefaultDOTGraphTraits(isSimple)
1115  {
1116  }

Member Function Documentation

◆ getEdgeAttributes()

template<class EdgeIter >
static std::string llvm::DOTGraphTraits< PAG * >::getEdgeAttributes ( PAGNode ,
EdgeIter  EI,
PAG  
)
inlinestatic

Definition at line 1156 of file PAG.cpp.

1157  {
1158  const PAGEdge* edge = *(EI.getCurrent());
1159  assert(edge && "No edge found!!");
1160  if (SVFUtil::isa<AddrPE>(edge))
1161  {
1162  return "color=green";
1163  }
1164  else if (SVFUtil::isa<CopyPE>(edge))
1165  {
1166  return "color=black";
1167  }
1168  else if (SVFUtil::isa<GepPE>(edge))
1169  {
1170  return "color=purple";
1171  }
1172  else if (SVFUtil::isa<StorePE>(edge))
1173  {
1174  return "color=blue";
1175  }
1176  else if (SVFUtil::isa<LoadPE>(edge))
1177  {
1178  return "color=red";
1179  }
1180  else if (SVFUtil::isa<CmpPE>(edge))
1181  {
1182  return "color=grey";
1183  }
1184  else if (SVFUtil::isa<BinaryOPPE>(edge))
1185  {
1186  return "color=grey";
1187  }
1188  else if (SVFUtil::isa<UnaryOPPE>(edge))
1189  {
1190  return "color=grey";
1191  }
1192  else if (SVFUtil::isa<TDForkPE>(edge))
1193  {
1194  return "color=Turquoise";
1195  }
1196  else if (SVFUtil::isa<TDJoinPE>(edge))
1197  {
1198  return "color=Turquoise";
1199  }
1200  else if (SVFUtil::isa<CallPE>(edge))
1201  {
1202  return "color=black,style=dashed";
1203  }
1204  else if (SVFUtil::isa<RetPE>(edge))
1205  {
1206  return "color=black,style=dotted";
1207  }
1208 
1209  assert(false && "No such kind edge!!");
1210  exit(1);
1211  }
VOID_OR_INT exit()
#define assert(ex)
Definition: util.h:141

◆ getEdgeSourceLabel()

template<class EdgeIter >
static std::string llvm::DOTGraphTraits< PAG * >::getEdgeSourceLabel ( PAGNode ,
EdgeIter  EI 
)
inlinestatic

Definition at line 1214 of file PAG.cpp.

1215  {
1216  const PAGEdge* edge = *(EI.getCurrent());
1217  assert(edge && "No edge found!!");
1218  if(const CallPE* calledge = SVFUtil::dyn_cast<CallPE>(edge))
1219  {
1220  const Instruction* callInst= calledge->getCallSite()->getCallSite();
1221  return SVFUtil::getSourceLoc(callInst);
1222  }
1223  else if(const RetPE* retedge = SVFUtil::dyn_cast<RetPE>(edge))
1224  {
1225  const Instruction* callInst= retedge->getCallSite()->getCallSite();
1226  return SVFUtil::getSourceLoc(callInst);
1227  }
1228  return "";
1229  }
#define assert(ex)
Definition: util.h:141
std::string getSourceLoc(const Value *val)
Return source code including line number and file name from debug information.
Definition: SVFUtil.cpp:259
llvm::Instruction Instruction
Definition: BasicTypes.h:79

◆ getGraphName()

static std::string llvm::DOTGraphTraits< PAG * >::getGraphName ( PAG graph)
inlinestatic

Return name of the graph.

Definition at line 1119 of file PAG.cpp.

1120  {
1121  return graph->getGraphName();
1122  }
std::string getGraphName() const
Return graph name.
Definition: PAG.h:846

◆ getNodeAttributes()

static std::string llvm::DOTGraphTraits< PAG * >::getNodeAttributes ( PAGNode node,
PAG  
)
inlinestatic

Definition at line 1150 of file PAG.cpp.

1151  {
1152  return node->getNodeAttrForDotDisplay();
1153  }
virtual const std::string getNodeAttrForDotDisplay() const
Get shape and/or color of node for .dot display.
Definition: PAG.cpp:54

◆ getNodeLabel()

static std::string llvm::DOTGraphTraits< PAG * >::getNodeLabel ( PAGNode node,
PAG  
)
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 1136 of file PAG.cpp.

1137  {
1138  std::string str;
1139  raw_string_ostream rawstr(str);
1140  // print function info
1141  if (node->getFunction())
1142  rawstr << "[" << node->getFunction()->getName() << "] ";
1143 
1144  rawstr << node->toString();
1145 
1146  return rawstr.str();
1147 
1148  }
virtual const std::string toString() const
Definition: PAG.cpp:46
virtual const Function * getFunction() const
Return the function that this PAGNode resides in. Return nullptr if it is a global or constantexpr no...
Definition: PAGNode.h:145
llvm::raw_string_ostream raw_string_ostream
Definition: BasicTypes.h:100

◆ isNodeHidden()

static bool llvm::DOTGraphTraits< PAG * >::isNodeHidden ( PAGNode node)
inlinestatic

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

Definition at line 1129 of file PAG.cpp.

1129  {
1130 #endif
1131  return node->isIsolatedNode();
1132  }
bool isIsolatedNode() const
Whether this is an isoloated node on the PAG graph.
Definition: PAG.cpp:1066

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