SVF
PAGNode.h
Go to the documentation of this file.
1 //===- PAGNode.h -- PAG node class-------------------------------------------//
2 //
3 // SVF: Static Value-Flow Analysis
4 //
5 // Copyright (C) <2013-2017> <Yulei Sui>
6 //
7 
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 
18 // You should have received a copy of the GNU General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //
21 //===----------------------------------------------------------------------===//
22 
23 /*
24  * PAGNode.h
25  *
26  * Created on: Nov 10, 2013
27  * Author: Yulei Sui
28  */
29 
30 #ifndef PAGNODE_H_
31 #define PAGNODE_H_
32 
33 #include "Graphs/GenericGraph.h"
34 #include "MemoryModel/MemModel.h"
35 #include "SVF-FE/SymbolTableInfo.h"
36 #include "SVF-FE/LLVMUtil.h"
37 
38 namespace SVF
39 {
40 
41 /*
42  * PAG node
43  */
45 class PAGNode : public GenericPAGNodeTy
46 {
47 
48 public:
59  enum PNODEK
60  {
70  CloneGepObjNode, // NOTE: only used for TBHC.
71  CloneFIObjNode, // NOTE: only used for TBHC.
72  CloneDummyObjNode // NOTE: only used for TBHC.
73  };
74 
75 
76 protected:
77  const Value* value;
80  bool isTLPointer;
81  bool isATPointer;
82 
83 public:
85  PAGNode(const Value* val, NodeID i, PNODEK k);
87  virtual ~PAGNode()
88  {
89  }
90 
92 
93  inline const Value* getValue() const
94  {
95  assert((this->getNodeKind() != DummyValNode && this->getNodeKind() != DummyObjNode) && "dummy node do not have value!");
96  assert((this->getId()!=SYMTYPE::BlackHole && this->getId() != SYMTYPE::ConstantObj) && "blackhole and constant obj do not have value");
97  assert(value && "value is null (GepObjNode whose basenode is a DummyObj?)");
98  return value;
99  }
100 
102  inline virtual const Type* getType() const
103  {
104  if (value)
105  return value->getType();
106  return nullptr;
107  }
108 
109  inline bool hasValue() const
110  {
111  return value!=nullptr;
112  }
114  virtual inline bool isPointer() const
115  {
116  return isTopLevelPtr() || isAddressTakenPtr();
117  }
119  inline bool isTopLevelPtr() const
120  {
121  return isTLPointer;
122  }
124  inline bool isAddressTakenPtr() const
125  {
126  return isATPointer;
127  }
130  inline bool isConstantData() const
131  {
132  if (hasValue())
133  return SVFUtil::isConstantData(value);
134  else
135  return false;
136  }
137 
139  bool isIsolatedNode() const;
140 
142  virtual const std::string getValueName() const = 0;
143 
145  virtual inline const Function* getFunction() const
146  {
147  if(value)
148  {
149  if(const Instruction* inst = SVFUtil::dyn_cast<Instruction>(value))
150  return inst->getParent()->getParent();
151  else if (const Argument* arg = SVFUtil::dyn_cast<Argument>(value))
152  return arg->getParent();
153  else if (const Function* fun = SVFUtil::dyn_cast<Function>(value))
154  return fun;
155  }
156  return nullptr;
157  }
158 
161  {
162  return InEdgeKindToSetMap[kind];
163  }
164 
167  {
168  return OutEdgeKindToSetMap[kind];
169  }
170 
172  inline bool hasIncomingEdges(PAGEdge::PEDGEK kind) const
173  {
174  PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
175  if (it != InEdgeKindToSetMap.end())
176  return (!it->second.empty());
177  else
178  return false;
179  }
180 
182  inline bool hasIncomingVariantGepEdge() const
183  {
184  PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = InEdgeKindToSetMap.find(PAGEdge::VariantGep);
185  if (it != InEdgeKindToSetMap.end())
186  {
187  return (!it->second.empty());
188  }
189  return false;
190  }
191 
193  inline PAGEdge::PAGEdgeSetTy::iterator getIncomingEdgesBegin(PAGEdge::PEDGEK kind) const
194  {
195  PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
196  assert(it!=InEdgeKindToSetMap.end() && "The node does not have such kind of edge");
197  return it->second.begin();
198  }
199 
201  inline PAGEdge::PAGEdgeSetTy::iterator getIncomingEdgesEnd(PAGEdge::PEDGEK kind) const
202  {
203  PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
204  assert(it!=InEdgeKindToSetMap.end() && "The node does not have such kind of edge");
205  return it->second.end();
206  }
207 
209  inline bool hasOutgoingEdges(PAGEdge::PEDGEK kind) const
210  {
211  PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
212  if (it != OutEdgeKindToSetMap.end())
213  return (!it->second.empty());
214  else
215  return false;
216  }
217 
219  inline PAGEdge::PAGEdgeSetTy::iterator getOutgoingEdgesBegin(PAGEdge::PEDGEK kind) const
220  {
221  PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
222  assert(it!=OutEdgeKindToSetMap.end() && "The node does not have such kind of edge");
223  return it->second.begin();
224  }
225 
227  inline PAGEdge::PAGEdgeSetTy::iterator getOutgoingEdgesEnd(PAGEdge::PEDGEK kind) const
228  {
229  PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
230  assert(it!=OutEdgeKindToSetMap.end() && "The node does not have such kind of edge");
231  return it->second.end();
232  }
234 
236 
237  inline void addInEdge(PAGEdge* inEdge)
238  {
239  GNodeK kind = inEdge->getEdgeKind();
240  InEdgeKindToSetMap[kind].insert(inEdge);
241  addIncomingEdge(inEdge);
242  }
243 
244  inline void addOutEdge(PAGEdge* outEdge)
245  {
246  GNodeK kind = outEdge->getEdgeKind();
247  OutEdgeKindToSetMap[kind].insert(outEdge);
248  addOutgoingEdge(outEdge);
249  }
250 
251  virtual const std::string toString() const;
252 
254  virtual const std::string getNodeAttrForDotDisplay() const;
255 
257  void dump() const;
258 
260 
262  friend raw_ostream& operator<< (raw_ostream &o, const PAGNode &node)
263  {
264  o << node.toString();
265  return o;
266  }
268 };
269 
270 
271 
272 /*
273  * Value(Pointer) node
274  */
275 class ValPN: public PAGNode
276 {
277 
278 public:
280 
281  static inline bool classof(const ValPN *)
282  {
283  return true;
284  }
285  static inline bool classof(const PAGNode *node)
286  {
287  return node->getNodeKind() == PAGNode::ValNode ||
288  node->getNodeKind() == PAGNode::GepValNode ||
290  }
291  static inline bool classof(const GenericPAGNodeTy *node)
292  {
293  return node->getNodeKind() == PAGNode::ValNode ||
294  node->getNodeKind() == PAGNode::GepValNode ||
296  }
298 
300  ValPN(const Value* val, NodeID i, PNODEK ty = ValNode) :
301  PAGNode(val, i, ty)
302  {
303  }
305  inline const std::string getValueName() const
306  {
307  if (value && value->hasName())
308  return value->getName().str();
309  return "";
310  }
311 
312  virtual const std::string toString() const;
313 };
314 
315 
316 /*
317  * Memory Object node
318  */
319 class ObjPN: public PAGNode
320 {
321 
322 protected:
323  const MemObj* mem;
324  ObjPN(const Value* val, NodeID i, const MemObj* m, PNODEK ty = ObjNode) :
326  PAGNode(val, i, ty), mem(m)
327  {
328  }
329 public:
331 
332  static inline bool classof(const ObjPN *)
333  {
334  return true;
335  }
336  static inline bool classof(const PAGNode *node)
337  {
338  return node->getNodeKind() == PAGNode::ObjNode ||
339  node->getNodeKind() == PAGNode::GepObjNode ||
340  node->getNodeKind() == PAGNode::FIObjNode ||
341  node->getNodeKind() == PAGNode::DummyObjNode ||
345  }
346  static inline bool classof(const GenericPAGNodeTy *node)
347  {
348  return node->getNodeKind() == PAGNode::ObjNode ||
349  node->getNodeKind() == PAGNode::GepObjNode ||
350  node->getNodeKind() == PAGNode::FIObjNode ||
351  node->getNodeKind() == PAGNode::DummyObjNode ||
355  }
357 
359  const MemObj* getMemObj() const
360  {
361  return mem;
362  }
363 
365  virtual const std::string getValueName() const
366  {
367  if (value && value->hasName())
368  return value->getName().str();
369  return "";
370  }
372  inline virtual const llvm::Type* getType() const
373  {
374  return mem->getType();
375  }
376 
377  virtual const std::string toString() const;
378 };
379 
380 
381 /*
382  * Gep Value (Pointer) node, this node can be dynamic generated for field sensitive analysis
383  * e.g. memcpy, temp gep value node needs to be created
384  * Each Gep Value node is connected to base value node via gep edge
385  */
386 class GepValPN: public ValPN
387 {
388 
389 private:
390  LocationSet ls; // LocationSet
391  const Type *gepValType;
393 
394 public:
396 
397  static inline bool classof(const GepValPN *)
398  {
399  return true;
400  }
401  static inline bool classof(const ValPN * node)
402  {
403  return node->getNodeKind() == PAGNode::GepValNode;
404  }
405  static inline bool classof(const PAGNode *node)
406  {
407  return node->getNodeKind() == PAGNode::GepValNode;
408  }
409  static inline bool classof(const GenericPAGNodeTy *node)
410  {
411  return node->getNodeKind() == PAGNode::GepValNode;
412  }
414 
416  GepValPN(const Value* val, NodeID i, const LocationSet& l, const Type *ty, u32_t idx) :
417  ValPN(val, i, GepValNode), ls(l), gepValType(ty), fieldIdx(idx)
418  {
419  }
420 
422  inline u32_t getOffset() const
423  {
424  return ls.getOffset();
425  }
426 
428  inline const std::string getValueName() const
429  {
430  if (value && value->hasName())
431  return value->getName().str() + "_" + llvm::utostr(getOffset());
432  return "offset_" + llvm::utostr(getOffset());
433  }
434 
435  inline const Type* getType() const
436  {
437  return gepValType;
438  }
439 
441  {
442  return fieldIdx;
443  }
444 
445  virtual const std::string toString() const;
446 };
447 
448 
449 /*
450  * Gep Obj node, this is dynamic generated for field sensitive analysis
451  * Each gep obj node is one field of a MemObj (base)
452  */
453 class GepObjPN: public ObjPN
454 {
455 private:
457  NodeID base = 0;
458 
459 public:
461 
462  static inline bool classof(const GepObjPN *)
463  {
464  return true;
465  }
466  static inline bool classof(const ObjPN * node)
467  {
468  return node->getNodeKind() == PAGNode::GepObjNode
470  }
471  static inline bool classof(const PAGNode *node)
472  {
473  return node->getNodeKind() == PAGNode::GepObjNode
475  }
476  static inline bool classof(const GenericPAGNodeTy *node)
477  {
478  return node->getNodeKind() == PAGNode::GepObjNode
480  }
482 
484  GepObjPN(const MemObj* mem, NodeID i, const LocationSet& l, PNODEK ty = GepObjNode) :
485  ObjPN(mem->getRefVal(), i, mem, ty), ls(l)
486  {
487  base = mem->getSymId();
488  }
489 
491  inline const LocationSet& getLocationSet() const
492  {
493  return ls;
494  }
495 
497  inline void setBaseNode(NodeID base)
498  {
499  this->base = base;
500  }
501 
503  inline NodeID getBaseNode(void) const
504  {
505  return base;
506  }
507 
509  inline virtual const llvm::Type* getType() const
510  {
512  }
513 
515  inline const std::string getValueName() const
516  {
517  if (value && value->hasName())
518  return value->getName().str() + "_" + llvm::itostr(ls.getOffset());
519  return "offset_" + llvm::itostr(ls.getOffset());
520  }
521 
522  virtual const std::string toString() const;
523 };
524 
525 /*
526  * Field-insensitive Gep Obj node, this is dynamic generated for field sensitive analysis
527  * Each field-insensitive gep obj node represents all fields of a MemObj (base)
528  */
529 class FIObjPN: public ObjPN
530 {
531 public:
532 
534 
535  static inline bool classof(const FIObjPN *)
536  {
537  return true;
538  }
539  static inline bool classof(const ObjPN * node)
540  {
541  return node->getNodeKind() == PAGNode::FIObjNode
542  || node->getNodeKind() == PAGNode::CloneFIObjNode;
543  }
544  static inline bool classof(const PAGNode *node)
545  {
546  return node->getNodeKind() == PAGNode::FIObjNode
547  || node->getNodeKind() == PAGNode::CloneFIObjNode;
548  }
549  static inline bool classof(const GenericPAGNodeTy *node)
550  {
551  return node->getNodeKind() == PAGNode::FIObjNode
552  || node->getNodeKind() == PAGNode::CloneFIObjNode;
553  }
555 
557  FIObjPN(const Value* val, NodeID i, const MemObj* mem, PNODEK ty = FIObjNode) :
558  ObjPN(val, i, mem, ty)
559  {
560  }
561 
563  inline const std::string getValueName() const
564  {
565  if (value && value->hasName())
566  return value->getName().str() + " (base object)";
567  return " (base object)";
568  }
569 
570  virtual const std::string toString() const;
571 };
572 
573 /*
574  * Unique Return node of a procedure
575  */
576 class RetPN: public PAGNode
577 {
578 
579 public:
580 
582  static inline bool classof(const RetPN *)
583  {
584  return true;
585  }
586  static inline bool classof(const PAGNode *node)
587  {
588  return node->getNodeKind() == PAGNode::RetNode;
589  }
590  static inline bool classof(const GenericPAGNodeTy *node)
591  {
592  return node->getNodeKind() == PAGNode::RetNode;
593  }
595 
597  RetPN(const SVFFunction* val, NodeID i) :
598  PAGNode(val->getLLVMFun(), i, RetNode)
599  {
600  }
601 
603  const std::string getValueName() const
604  {
605  return value->getName().str() + "_ret";
606  }
607 
608  virtual const std::string toString() const;
609 };
610 
611 
612 /*
613  * Unique vararg node of a procedure
614  */
615 class VarArgPN: public PAGNode
616 {
617 
618 public:
619 
621  static inline bool classof(const VarArgPN *)
622  {
623  return true;
624  }
625  static inline bool classof(const PAGNode *node)
626  {
627  return node->getNodeKind() == PAGNode::VarargNode;
628  }
629  static inline bool classof(const GenericPAGNodeTy *node)
630  {
631  return node->getNodeKind() == PAGNode::VarargNode;
632  }
634 
636  VarArgPN(const SVFFunction* val, NodeID i) :
637  PAGNode(val->getLLVMFun(), i, VarargNode)
638  {
639  }
640 
642  inline const std::string getValueName() const
643  {
644  return value->getName().str() + "_vararg";
645  }
646 
647  virtual const std::string toString() const;
648 };
649 
650 
651 
652 
653 /*
654  * Dummy node
655  */
656 class DummyValPN: public ValPN
657 {
658 
659 public:
660 
662  static inline bool classof(const DummyValPN *)
663  {
664  return true;
665  }
666  static inline bool classof(const PAGNode *node)
667  {
668  return node->getNodeKind() == PAGNode::DummyValNode;
669  }
670  static inline bool classof(const GenericPAGNodeTy *node)
671  {
672  return node->getNodeKind() == PAGNode::DummyValNode;
673  }
675 
678  {
679  }
680 
681 
683  inline const std::string getValueName() const
684  {
685  return "dummyVal";
686  }
687 
688  virtual const std::string toString() const;
689 };
690 
691 
692 /*
693  * Dummy node
694  */
695 class DummyObjPN: public ObjPN
696 {
697 
698 public:
699 
701  static inline bool classof(const DummyObjPN *)
702  {
703  return true;
704  }
705  static inline bool classof(const PAGNode *node)
706  {
707  return node->getNodeKind() == PAGNode::DummyObjNode
709  }
710  static inline bool classof(const GenericPAGNodeTy *node)
711  {
712  return node->getNodeKind() == PAGNode::DummyObjNode
714  }
716 
719  : ObjPN(nullptr, i, m, ty)
720  {
721  }
722 
724  inline const std::string getValueName() const
725  {
726  return "dummyObj";
727  }
728 
729  virtual const std::string toString() const;
730 };
731 
732 /*
733  * Clone object node for dummy objects.
734  */
736 {
737 public:
739  static inline bool classof(const CloneDummyObjPN *)
740  {
741  return true;
742  }
743  static inline bool classof(const PAGNode *node)
744  {
745  return node->getNodeKind() == PAGNode::CloneDummyObjNode;
746  }
747  static inline bool classof(const GenericPAGNodeTy *node)
748  {
749  return node->getNodeKind() == PAGNode::CloneDummyObjNode;
750  }
752 
755  : DummyObjPN(i, m, ty)
756  {
757  }
758 
760  inline const std::string getValueName() const
761  {
762  return "clone of " + ObjPN::getValueName();
763  }
764 
765  virtual const std::string toString() const;
766 };
767 
768 /*
769  * Clone object for GEP objects.
770  */
771 class CloneGepObjPN : public GepObjPN
772 {
773 public:
775  static inline bool classof(const CloneGepObjPN *)
776  {
777  return true;
778  }
779  static inline bool classof(const PAGNode *node)
780  {
781  return node->getNodeKind() == PAGNode::CloneGepObjNode;
782  }
783  static inline bool classof(const GenericPAGNodeTy *node)
784  {
785  return node->getNodeKind() == PAGNode::CloneGepObjNode;
786  }
788 
790  CloneGepObjPN(const MemObj* mem, NodeID i, const LocationSet& l, PNODEK ty = CloneGepObjNode) :
791  GepObjPN(mem, i, l, ty)
792  {
793  }
794 
796  inline const std::string getValueName() const
797  {
798  return "clone (gep) of " + GepObjPN::getValueName();
799  }
800 
801  virtual const std::string toString() const;
802 };
803 
804 /*
805  * Clone object for FI objects.
806  */
807 class CloneFIObjPN : public FIObjPN
808 {
809 public:
811  static inline bool classof(const CloneFIObjPN *)
812  {
813  return true;
814  }
815  static inline bool classof(const PAGNode *node)
816  {
817  return node->getNodeKind() == PAGNode::CloneFIObjNode;
818  }
819  static inline bool classof(const GenericPAGNodeTy *node)
820  {
821  return node->getNodeKind() == PAGNode::CloneFIObjNode;
822  }
824 
826  CloneFIObjPN(const Value* val, NodeID i, const MemObj* mem, PNODEK ty = CloneFIObjNode) :
827  FIObjPN(val, i, mem, ty)
828  {
829  }
830 
832  inline const std::string getValueName() const
833  {
834  return "clone (FI) of " + FIObjPN::getValueName();
835  }
836 
837  virtual const std::string toString() const;
838 };
839 
840 } // End namespace SVF
841 
842 #endif /* PAGNODE_H_ */
ValPN(const Value *val, NodeID i, PNODEK ty=ValNode)
Constructor.
Definition: PAGNode.h:300
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:549
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:590
GenericNode< PAGNode, PAGEdge > GenericPAGNodeTy
Definition: PAGNode.h:44
static bool classof(const CloneFIObjPN *)
Definition: PAGNode.h:811
static bool classof(const PAGNode *node)
Definition: PAGNode.h:471
GEdgeKind getEdgeKind() const
Definition: GenericGraph.h:81
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:629
const Type * gepValType
Definition: PAGNode.h:391
virtual const std::string toString() const
Definition: PAG.cpp:46
bool isIsolatedNode() const
Whether this is an isoloated node on the PAG graph.
Definition: PAG.cpp:1066
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:409
s32_t GNodeK
Edge kind.
Definition: GenericGraph.h:135
const MemObj * getMemObj() const
Return memory object.
Definition: PAGNode.h:359
llvm::raw_ostream raw_ostream
LLVM outputs.
Definition: BasicTypes.h:99
LocationSet ls
Definition: PAGNode.h:456
u32_t NodeID
Definition: SVFBasicTypes.h:80
bool hasIncomingEdges(PAGEdge::PEDGEK kind) const
Has incoming PAG edges.
Definition: PAGNode.h:172
llvm::Type Type
Definition: BasicTypes.h:75
const Type * getType() const
Return type of the value.
Definition: PAGNode.h:435
bool isTLPointer
Definition: PAGNode.h:80
Size_t getByteOffset() const
Definition: LocationSet.h:198
void setBaseNode(NodeID base)
Set the base object from which this GEP node came from.
Definition: PAGNode.h:497
#define assert(ex)
Definition: util.h:141
GenericNode< PAGNode, PAGEdge >::GEdgeSetTy PAGEdgeSetTy
Definition: PAGEdge.h:169
const std::string getValueName() const
Return name of this node.
Definition: PAGNode.h:760
static bool classof(const ValPN *node)
Definition: PAGNode.h:401
const llvm::Type * getType() const
Get obj type.
Definition: MemModel.cpp:278
PAGEdge::PAGEdgeSetTy & getIncomingEdges(PAGEdge::PEDGEK kind)
Get incoming PAG edges.
Definition: PAGNode.h:160
RetPN(const SVFFunction *val, NodeID i)
Constructor.
Definition: PAGNode.h:597
static bool classof(const PAGNode *node)
Definition: PAGNode.h:336
DummyObjPN(NodeID i, const MemObj *m, PNODEK ty=DummyObjNode)
Constructor.
Definition: PAGNode.h:718
const std::string getValueName() const
Return name of a LLVM value.
Definition: PAGNode.h:642
const Value * getValue() const
Get/has methods of the components.
Definition: PAGNode.h:93
GNodeK getNodeKind() const
Get node kind.
Definition: GenericGraph.h:170
bool hasOutgoingEdges(PAGEdge::PEDGEK kind) const
Has outgoing PAG edges.
Definition: PAGNode.h:209
const Value * value
value of this PAG node
Definition: PAGNode.h:77
friend raw_ostream & operator<<(raw_ostream &o, const PAGNode &node)
Overloading operator << for dumping PAGNode value.
Definition: PAGNode.h:262
NodeID getBaseNode(void) const
Return the base object from which this GEP node came from.
Definition: PAGNode.h:503
unsigned u32_t
Definition: SVFBasicTypes.h:75
virtual const std::string getValueName() const =0
Get name of the LLVM value.
static bool classof(const PAGNode *node)
Definition: PAGNode.h:544
static bool classof(const PAGNode *node)
Definition: PAGNode.h:586
const std::string getValueName() const
Return name of this node.
Definition: PAGNode.h:832
static bool classof(const PAGNode *node)
Definition: PAGNode.h:779
static bool classof(const FIObjPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: PAGNode.h:535
const std::string getValueName() const
Return name of a LLVM value.
Definition: PAGNode.h:603
CloneGepObjPN(const MemObj *mem, NodeID i, const LocationSet &l, PNODEK ty=CloneGepObjNode)
Constructor.
Definition: PAGNode.h:790
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
PAGEdge::PAGKindToEdgeSetMapTy InEdgeKindToSetMap
Definition: PAGNode.h:78
GepValPN(const Value *val, NodeID i, const LocationSet &l, const Type *ty, u32_t idx)
Constructor.
Definition: PAGNode.h:416
bool isATPointer
top-level pointer
Definition: PAGNode.h:81
CloneDummyObjPN(NodeID i, const MemObj *m, PNODEK ty=CloneDummyObjNode)
Constructor.
Definition: PAGNode.h:754
DummyValPN(NodeID i)
Constructor.
Definition: PAGNode.h:677
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:476
PAGEdge::PAGEdgeSetTy::iterator getIncomingEdgesBegin(PAGEdge::PEDGEK kind) const
Get incoming PAGEdge iterator.
Definition: PAGNode.h:193
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:819
const std::string getValueName() const
Return name of this node.
Definition: PAGNode.h:796
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:346
static bool classof(const RetPN *)
Definition: PAGNode.h:582
llvm::Function Function
Definition: BasicTypes.h:76
bool isConstantData() const
Definition: PAGNode.h:130
static bool classof(const PAGNode *node)
Definition: PAGNode.h:405
FIObjPN(const Value *val, NodeID i, const MemObj *mem, PNODEK ty=FIObjNode)
Constructor.
Definition: PAGNode.h:557
llvm::Instruction Instruction
Definition: BasicTypes.h:79
PAGEdge::PAGEdgeSetTy::iterator getIncomingEdgesEnd(PAGEdge::PEDGEK kind) const
Get incoming PAGEdge iterator.
Definition: PAGNode.h:201
u32_t fieldIdx
Definition: PAGNode.h:392
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:710
const std::string getValueName() const
Return name of a LLVM value.
Definition: PAGNode.h:305
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:291
static bool classof(const PAGNode *node)
Definition: PAGNode.h:705
llvm::Argument Argument
LLVM Aliases and constants.
Definition: BasicTypes.h:122
u32_t getFieldIdx() const
Definition: PAGNode.h:440
bool addOutgoingEdge(EdgeType *outEdge)
Definition: GenericGraph.h:278
const std::string getValueName() const
Return name of a LLVM value.
Definition: PAGNode.h:515
PAGEdge::PAGKindToEdgeSetMapTy OutEdgeKindToSetMap
Definition: PAGNode.h:79
u32_t getOffset() const
offset of the base value node
Definition: PAGNode.h:422
static bool classof(const PAGNode *node)
Definition: PAGNode.h:743
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:747
static SymbolTableInfo * SymbolInfo()
Singleton design here to make sure we only have one instance during any analysis. ...
static bool classof(const ObjPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: PAGNode.h:332
static bool classof(const ObjPN *node)
Definition: PAGNode.h:539
static bool classof(const GepValPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: PAGNode.h:397
static bool classof(const ObjPN *node)
Definition: PAGNode.h:466
bool hasValue() const
Definition: PAGNode.h:109
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
Definition: GenericGraph.h:274
VarArgPN(const SVFFunction *val, NodeID i)
Constructor.
Definition: PAGNode.h:636
static bool classof(const ValPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: PAGNode.h:281
static bool classof(const CloneDummyObjPN *)
Definition: PAGNode.h:739
const std::string getValueName() const
Return name of this node.
Definition: PAGNode.h:724
static bool classof(const PAGNode *node)
Definition: PAGNode.h:666
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:670
SymID getSymId() const
Get the memory object id.
Definition: MemModel.h:331
PAGEdge::PAGEdgeSetTy::iterator getOutgoingEdgesBegin(PAGEdge::PEDGEK kind) const
Get outgoing PAGEdge iterator.
Definition: PAGNode.h:219
static bool classof(const PAGNode *node)
Definition: PAGNode.h:815
virtual const llvm::Type * getType() const
Return the type of this gep object.
Definition: PAGNode.h:509
bool isTopLevelPtr() const
Whether it is a top-level pointer.
Definition: PAGNode.h:119
static bool classof(const GepObjPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: PAGNode.h:462
static bool classof(const DummyValPN *)
Definition: PAGNode.h:662
Size_t getOffset() const
Get methods.
Definition: LocationSet.h:194
GepObjPN(const MemObj *mem, NodeID i, const LocationSet &l, PNODEK ty=GepObjNode)
Constructor.
Definition: PAGNode.h:484
const Type * getOrigSubTypeWithByteOffset(const Type *baseType, u32_t byteOffset)
bool isConstantData(const Value *val)
Return true if the value refers to constant data, e.g., i32 0.
Definition: LLVMUtil.h:393
bool hasIncomingVariantGepEdge() const
Has incoming VariantGepEdges.
Definition: PAGNode.h:182
virtual ~PAGNode()
Destructor.
Definition: PAGNode.h:87
for isBitcode
Definition: ContextDDA.h:15
void addInEdge(PAGEdge *inEdge)
add methods of the components
Definition: PAGNode.h:237
const std::string getValueName() const
Return name of this node.
Definition: PAGNode.h:683
NodeID getId() const
Get ID.
Definition: GenericGraph.h:164
const MemObj * mem
Definition: PAGNode.h:323
PAGNode(const Value *val, NodeID i, PNODEK k)
address-taken pointer
Definition: PAG.cpp:1018
bool isAddressTakenPtr() const
Whether it is an address-taken pointer.
Definition: PAGNode.h:124
CloneFIObjPN(const Value *val, NodeID i, const MemObj *mem, PNODEK ty=CloneFIObjNode)
Constructor.
Definition: PAGNode.h:826
static bool classof(const CloneGepObjPN *)
Definition: PAGNode.h:775
virtual const std::string getNodeAttrForDotDisplay() const
Get shape and/or color of node for .dot display.
Definition: PAG.cpp:54
PAGEdgeToSetMapTy PAGKindToEdgeSetMapTy
Definition: PAGEdge.h:171
const std::string getValueName() const
Return name of a LLVM value.
Definition: PAGNode.h:428
static bool classof(const GenericPAGNodeTy *node)
Definition: PAGNode.h:783
PAGEdge::PAGEdgeSetTy & getOutgoingEdges(PAGEdge::PEDGEK kind)
Get outgoing PAG edges.
Definition: PAGNode.h:166
static bool classof(const PAGNode *node)
Definition: PAGNode.h:625
virtual const std::string getValueName() const
Return name of a LLVM value.
Definition: PAGNode.h:365
const LocationSet & getLocationSet() const
offset of the mem object
Definition: PAGNode.h:491
static bool classof(const DummyObjPN *)
Definition: PAGNode.h:701
virtual const Type * getType() const
Return type of the value.
Definition: PAGNode.h:102
const std::string getValueName() const
Return name of a LLVM value.
Definition: PAGNode.h:563
llvm::Value Value
Definition: BasicTypes.h:78
void dump() const
Dump to console for debugging.
Definition: PAG.cpp:92
virtual bool isPointer() const
Whether it is a pointer.
Definition: PAGNode.h:114
void addOutEdge(PAGEdge *outEdge)
Definition: PAGNode.h:244
LocationSet ls
Definition: PAGNode.h:390
PAGEdge::PAGEdgeSetTy::iterator getOutgoingEdgesEnd(PAGEdge::PEDGEK kind) const
Get outgoing PAGEdge iterator.
Definition: PAGNode.h:227
static bool classof(const VarArgPN *)
Definition: PAGNode.h:621
static bool classof(const PAGNode *node)
Definition: PAGNode.h:285
virtual const llvm::Type * getType() const
Return type of the value.
Definition: PAGNode.h:372