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

Public Types

typedef ConstraintNode NodeType
 

Public Member Functions

 DOTGraphTraits (bool isSimple=false)
 

Static Public Member Functions

static std::string getGraphName (OfflineConsG *)
 Return name of the graph. More...
 
static std::string getNodeLabel (NodeType *n, OfflineConsG *)
 
static std::string getNodeAttributes (NodeType *n, OfflineConsG *)
 
template<class EdgeIter >
static std::string getEdgeAttributes (NodeType *, EdgeIter EI, OfflineConsG *)
 
template<class EdgeIter >
static std::string getEdgeSourceLabel (NodeType *, EdgeIter)
 

Detailed Description

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

Definition at line 182 of file OfflineConsG.cpp.

Member Typedef Documentation

◆ NodeType

typedef ConstraintNode llvm::DOTGraphTraits< OfflineConsG * >::NodeType

Definition at line 185 of file OfflineConsG.cpp.

Constructor & Destructor Documentation

◆ DOTGraphTraits()

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

Definition at line 186 of file OfflineConsG.cpp.

186  :
187  DOTGraphTraits<PAG*>(isSimple)
188  {
189  }

Member Function Documentation

◆ getEdgeAttributes()

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

Definition at line 255 of file OfflineConsG.cpp.

256  {
257  ConstraintEdge* edge = *(EI.getCurrent());
258  assert(edge && "No edge found!!");
259  if (edge->getEdgeKind() == ConstraintEdge::Addr)
260  {
261  return "color=green";
262  }
263  else if (edge->getEdgeKind() == ConstraintEdge::Copy)
264  {
265  return "color=black";
266  }
267  else if (edge->getEdgeKind() == ConstraintEdge::NormalGep
268  || edge->getEdgeKind() == ConstraintEdge::VariantGep)
269  {
270  return "color=purple";
271  }
272  else if (edge->getEdgeKind() == ConstraintEdge::Store)
273  {
274  return "color=blue";
275  }
276  else if (edge->getEdgeKind() == ConstraintEdge::Load)
277  {
278  return "color=red";
279  }
280  else
281  {
282  assert(0 && "No such kind edge!!");
283  }
284  return "";
285  }
GEdgeKind getEdgeKind() const
Definition: GenericGraph.h:81
#define assert(ex)
Definition: util.h:141

◆ getEdgeSourceLabel()

template<class EdgeIter >
static std::string llvm::DOTGraphTraits< OfflineConsG * >::getEdgeSourceLabel ( NodeType ,
EdgeIter   
)
inlinestatic

Definition at line 288 of file OfflineConsG.cpp.

289  {
290  return "";
291  }

◆ getGraphName()

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

Return name of the graph.

Definition at line 192 of file OfflineConsG.cpp.

193  {
194  return "Offline Constraint Graph";
195  }

◆ getNodeAttributes()

static std::string llvm::DOTGraphTraits< OfflineConsG * >::getNodeAttributes ( NodeType n,
OfflineConsG  
)
inlinestatic

Definition at line 241 of file OfflineConsG.cpp.

242  {
243  if (PAG::getPAG()->findPAGNode(n->getId()))
244  {
245  PAGNode *node = PAG::getPAG()->getPAGNode(n->getId());
246  return node->getNodeAttrForDotDisplay();
247  }
248  else
249  {
250  return "shape=folder";
251  }
252  }
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< OfflineConsG * >::getNodeLabel ( NodeType n,
OfflineConsG  
)
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 199 of file OfflineConsG.cpp.

200  {
201  std::string str;
202  raw_string_ostream rawstr(str);
203  if (PAG::getPAG()->findPAGNode(n->getId()))
204  {
205  PAGNode *node = PAG::getPAG()->getPAGNode(n->getId());
206  bool briefDisplay = true;
207  bool nameDisplay = true;
208 
209 
210  if (briefDisplay)
211  {
212  if (SVFUtil::isa<ValPN>(node))
213  {
214  if (nameDisplay)
215  rawstr << node->getId() << ":" << node->getValueName();
216  else
217  rawstr << node->getId();
218  }
219  else
220  rawstr << node->getId();
221  }
222  else
223  {
224  // print the whole value
225  if (!SVFUtil::isa<DummyValPN>(node) && !SVFUtil::isa<DummyObjPN>(node))
226  rawstr << *node->getValue();
227  else
228  rawstr << "";
229 
230  }
231 
232  return rawstr.str();
233  }
234  else
235  {
236  rawstr<< n->getId();
237  return rawstr.str();
238  }
239  }
const Value * getValue() const
Get/has methods of the components.
Definition: PAGNode.h:93
virtual const std::string getValueName() const =0
Get name of the LLVM value.
llvm::raw_string_ostream raw_string_ostream
Definition: BasicTypes.h:100
NodeID getId() const
Get ID.
Definition: GenericGraph.h:164

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