97 assert(value &&
"value is null (GepObjNode whose basenode is a DummyObj?)");
105 return value->getType();
111 return value!=
nullptr;
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))
162 return InEdgeKindToSetMap[kind];
168 return OutEdgeKindToSetMap[kind];
174 PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
175 if (it != InEdgeKindToSetMap.end())
176 return (!it->second.empty());
184 PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = InEdgeKindToSetMap.find(
PAGEdge::VariantGep);
185 if (it != InEdgeKindToSetMap.end())
187 return (!it->second.empty());
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();
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();
211 PAGEdge::PAGKindToEdgeSetMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
212 if (it != OutEdgeKindToSetMap.end())
213 return (!it->second.empty());
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();
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();
240 InEdgeKindToSetMap[kind].insert(inEdge);
247 OutEdgeKindToSetMap[kind].insert(outEdge);
251 virtual const std::string
toString()
const;
291 static inline bool classof(
const GenericPAGNodeTy *node)
308 return value->getName().str();
312 virtual const std::string
toString()
const;
346 static inline bool classof(
const GenericPAGNodeTy *node)
368 return value->getName().str();
377 virtual const std::string
toString()
const;
409 static inline bool classof(
const GenericPAGNodeTy *node)
431 return value->getName().str() +
"_" + llvm::utostr(getOffset());
432 return "offset_" + llvm::utostr(getOffset());
445 virtual const std::string
toString()
const;
476 static inline bool classof(
const GenericPAGNodeTy *node)
485 ObjPN(mem->getRefVal(), i, mem, ty), ls(l)
518 return value->getName().str() +
"_" + llvm::itostr(ls.
getOffset());
519 return "offset_" + llvm::itostr(ls.
getOffset());
522 virtual const std::string
toString()
const;
549 static inline bool classof(
const GenericPAGNodeTy *node)
558 ObjPN(val, i, mem, ty)
566 return value->getName().str() +
" (base object)";
567 return " (base object)";
570 virtual const std::string
toString()
const;
590 static inline bool classof(
const GenericPAGNodeTy *node)
605 return value->getName().str() +
"_ret";
608 virtual const std::string
toString()
const;
629 static inline bool classof(
const GenericPAGNodeTy *node)
644 return value->getName().str() +
"_vararg";
647 virtual const std::string
toString()
const;
670 static inline bool classof(
const GenericPAGNodeTy *node)
688 virtual const std::string
toString()
const;
710 static inline bool classof(
const GenericPAGNodeTy *node)
719 :
ObjPN(nullptr, i, m, ty)
729 virtual const std::string
toString()
const;
747 static inline bool classof(
const GenericPAGNodeTy *node)
765 virtual const std::string
toString()
const;
783 static inline bool classof(
const GenericPAGNodeTy *node)
801 virtual const std::string
toString()
const;
819 static inline bool classof(
const GenericPAGNodeTy *node)
837 virtual const std::string
toString()
const;
ValPN(const Value *val, NodeID i, PNODEK ty=ValNode)
Constructor.
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const GenericPAGNodeTy *node)
GenericNode< PAGNode, PAGEdge > GenericPAGNodeTy
static bool classof(const CloneFIObjPN *)
static bool classof(const PAGNode *node)
GEdgeKind getEdgeKind() const
static bool classof(const GenericPAGNodeTy *node)
virtual const std::string toString() const
bool isIsolatedNode() const
Whether this is an isoloated node on the PAG graph.
static bool classof(const GenericPAGNodeTy *node)
const MemObj * getMemObj() const
Return memory object.
llvm::raw_ostream raw_ostream
LLVM outputs.
bool hasIncomingEdges(PAGEdge::PEDGEK kind) const
Has incoming PAG edges.
const Type * getType() const
Return type of the value.
Size_t getByteOffset() const
void setBaseNode(NodeID base)
Set the base object from which this GEP node came from.
GenericNode< PAGNode, PAGEdge >::GEdgeSetTy PAGEdgeSetTy
const std::string getValueName() const
Return name of this node.
static bool classof(const ValPN *node)
const llvm::Type * getType() const
Get obj type.
PAGEdge::PAGEdgeSetTy & getIncomingEdges(PAGEdge::PEDGEK kind)
Get incoming PAG edges.
RetPN(const SVFFunction *val, NodeID i)
Constructor.
static bool classof(const PAGNode *node)
DummyObjPN(NodeID i, const MemObj *m, PNODEK ty=DummyObjNode)
Constructor.
const std::string getValueName() const
Return name of a LLVM value.
const Value * getValue() const
Get/has methods of the components.
GNodeK getNodeKind() const
Get node kind.
bool hasOutgoingEdges(PAGEdge::PEDGEK kind) const
Has outgoing PAG edges.
const Value * value
value of this PAG node
friend raw_ostream & operator<<(raw_ostream &o, const PAGNode &node)
Overloading operator << for dumping PAGNode value.
NodeID getBaseNode(void) const
Return the base object from which this GEP node came from.
virtual const std::string getValueName() const =0
Get name of the LLVM value.
static bool classof(const PAGNode *node)
static bool classof(const PAGNode *node)
const std::string getValueName() const
Return name of this node.
static bool classof(const PAGNode *node)
static bool classof(const FIObjPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const std::string getValueName() const
Return name of a LLVM value.
CloneGepObjPN(const MemObj *mem, NodeID i, const LocationSet &l, PNODEK ty=CloneGepObjNode)
Constructor.
virtual const Function * getFunction() const
Return the function that this PAGNode resides in. Return nullptr if it is a global or constantexpr no...
PAGEdge::PAGKindToEdgeSetMapTy InEdgeKindToSetMap
GepValPN(const Value *val, NodeID i, const LocationSet &l, const Type *ty, u32_t idx)
Constructor.
bool isATPointer
top-level pointer
CloneDummyObjPN(NodeID i, const MemObj *m, PNODEK ty=CloneDummyObjNode)
Constructor.
DummyValPN(NodeID i)
Constructor.
static bool classof(const GenericPAGNodeTy *node)
PAGEdge::PAGEdgeSetTy::iterator getIncomingEdgesBegin(PAGEdge::PEDGEK kind) const
Get incoming PAGEdge iterator.
static bool classof(const GenericPAGNodeTy *node)
const std::string getValueName() const
Return name of this node.
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const RetPN *)
bool isConstantData() const
static bool classof(const PAGNode *node)
FIObjPN(const Value *val, NodeID i, const MemObj *mem, PNODEK ty=FIObjNode)
Constructor.
llvm::Instruction Instruction
PAGEdge::PAGEdgeSetTy::iterator getIncomingEdgesEnd(PAGEdge::PEDGEK kind) const
Get incoming PAGEdge iterator.
static bool classof(const GenericPAGNodeTy *node)
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const PAGNode *node)
llvm::Argument Argument
LLVM Aliases and constants.
u32_t getFieldIdx() const
bool addOutgoingEdge(EdgeType *outEdge)
const std::string getValueName() const
Return name of a LLVM value.
PAGEdge::PAGKindToEdgeSetMapTy OutEdgeKindToSetMap
u32_t getOffset() const
offset of the base value node
static bool classof(const PAGNode *node)
static bool classof(const GenericPAGNodeTy *node)
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:
static bool classof(const ObjPN *node)
static bool classof(const GepValPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const ObjPN *node)
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
VarArgPN(const SVFFunction *val, NodeID i)
Constructor.
static bool classof(const ValPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const CloneDummyObjPN *)
const std::string getValueName() const
Return name of this node.
static bool classof(const PAGNode *node)
static bool classof(const GenericPAGNodeTy *node)
SymID getSymId() const
Get the memory object id.
PAGEdge::PAGEdgeSetTy::iterator getOutgoingEdgesBegin(PAGEdge::PEDGEK kind) const
Get outgoing PAGEdge iterator.
static bool classof(const PAGNode *node)
virtual const llvm::Type * getType() const
Return the type of this gep object.
bool isTopLevelPtr() const
Whether it is a top-level pointer.
static bool classof(const GepObjPN *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const DummyValPN *)
Size_t getOffset() const
Get methods.
GepObjPN(const MemObj *mem, NodeID i, const LocationSet &l, PNODEK ty=GepObjNode)
Constructor.
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.
bool hasIncomingVariantGepEdge() const
Has incoming VariantGepEdges.
virtual ~PAGNode()
Destructor.
void addInEdge(PAGEdge *inEdge)
add methods of the components
const std::string getValueName() const
Return name of this node.
NodeID getId() const
Get ID.
PAGNode(const Value *val, NodeID i, PNODEK k)
address-taken pointer
bool isAddressTakenPtr() const
Whether it is an address-taken pointer.
CloneFIObjPN(const Value *val, NodeID i, const MemObj *mem, PNODEK ty=CloneFIObjNode)
Constructor.
static bool classof(const CloneGepObjPN *)
virtual const std::string getNodeAttrForDotDisplay() const
Get shape and/or color of node for .dot display.
PAGEdgeToSetMapTy PAGKindToEdgeSetMapTy
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const GenericPAGNodeTy *node)
PAGEdge::PAGEdgeSetTy & getOutgoingEdges(PAGEdge::PEDGEK kind)
Get outgoing PAG edges.
static bool classof(const PAGNode *node)
virtual const std::string getValueName() const
Return name of a LLVM value.
const LocationSet & getLocationSet() const
offset of the mem object
static bool classof(const DummyObjPN *)
virtual const Type * getType() const
Return type of the value.
const std::string getValueName() const
Return name of a LLVM value.
void dump() const
Dump to console for debugging.
virtual bool isPointer() const
Whether it is a pointer.
void addOutEdge(PAGEdge *outEdge)
PAGEdge::PAGEdgeSetTy::iterator getOutgoingEdgesEnd(PAGEdge::PEDGEK kind) const
Get outgoing PAGEdge iterator.
static bool classof(const VarArgPN *)
static bool classof(const PAGNode *node)
virtual const llvm::Type * getType() const
Return type of the value.