30 #ifndef INCLUDE_SVFIR_SVFVARIABLE_H_
31 #define INCLUDE_SVFIR_SVFVARIABLE_H_
87 "dummy node do not have value!");
89 "blackhole and constant obj do not have value");
91 "value is null (GepObjNode whose basenode is a DummyObj?)");
103 return value !=
nullptr;
126 if (
auto inst = SVFUtil::dyn_cast<SVFInstruction>(
value))
127 return inst->getParent()->getParent();
128 else if (
auto arg = SVFUtil::dyn_cast<SVFArgument>(
value))
129 return arg->getParent();
130 else if (
auto fun = SVFUtil::dyn_cast<SVFFunction>(
value))
151 return (!it->second.empty());
160 return (!it->second.empty());
170 return it->second.begin();
178 return it->second.end();
186 return it->second.begin();
194 return it->second.end();
235 for(
auto gep : it->second)
237 if(SVFUtil::cast<GepStmt>(gep)->isVariantFieldGep())
528 return "offset_" + std::to_string(
apOffset);
584 return " (base object)";
769 :
ObjVar(nullptr, i, m, ty)
APOffset getConstantStructFldIdx() const
Get methods.
virtual const std::string toString() const
DummyObjVar(NodeID i, const MemObj *m, PNODEK ty=DummyObjNode)
Constructor.
static bool classof(const DummyObjVar *)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const SVFVar *node)
static bool classof(const ObjVar *node)
DummyObjVar(NodeID i)
Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
const std::string getValueName() const
Return name of this node.
static bool classof(const DummyValVar *)
const std::string getValueName() const
Return name of this node.
DummyValVar(NodeID i)
Constructor.
static bool classof(const ValVar *node)
virtual const std::string toString() const
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const ObjVar *node)
static bool classof(const FIObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFVar *node)
FIObjVar(const SVFValue *val, NodeID i, const MemObj *mem, PNODEK ty=FIObjNode)
Constructor.
const std::string getValueName() const
Return name of a LLVM value.
FIObjVar(NodeID i, PNODEK ty=FIObjNode)
Constructor to create empty ObjVar (for SVFIRReader/deserialization)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFBaseNode *node)
virtual const std::string toString() const
GEdgeKind getEdgeKind() const
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
bool addOutgoingEdge(EdgeType *outEdge)
APOffset getConstantFieldIdx() const
offset of the mem object
virtual const SVFType * getType() const
Return the type of this gep object.
GepObjVar(NodeID i, PNODEK ty=GepObjNode)
Constructor to create empty GepObjVar (for SVFIRReader/deserialization)
NodeID getBaseNode(void) const
Return the base object from which this GEP node came from.
void setBaseNode(NodeID bs)
Set the base object from which this GEP node came from.
const std::string getValueName() const
Return name of a LLVM value.
virtual const std::string toString() const
static bool classof(const GepObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const ObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
GepObjVar(const MemObj *mem, NodeID i, const APOffset &apOffset, PNODEK ty=GepObjNode)
Constructor.
static bool classof(const SVFVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const GenericPAGNodeTy *node)
const SVFType * getType() const
Return type of the value.
static bool classof(const GepValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const SVFType * gepValType
GepValVar(const SVFValue *val, NodeID i, const AccessPath &ap, const SVFType *ty)
Constructor.
static bool classof(const SVFVar *node)
GepValVar(NodeID i)
Constructor to create empty GeValVar (for SVFIRReader/deserialization)
virtual const std::string toString() const
APOffset getConstantFieldIdx() const
offset of the base value variable
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const ValVar *node)
const SVFType * getType() const
Get obj type.
SymID getId() const
Get the memory object id.
ObjVar(NodeID i, PNODEK ty=ObjNode)
Constructor to create an empty ObjVar (for SVFIRReader/deserialization)
virtual const std::string toString() const
virtual const SVFType * getType() const
Return type of the value.
static bool classof(const GenericPAGNodeTy *node)
const MemObj * getMemObj() const
Return memory object.
static bool classof(const SVFVar *node)
static bool classof(const SVFBaseNode *node)
ObjVar(const SVFValue *val, NodeID i, const MemObj *m, PNODEK ty=ObjNode)
Constructor.
static bool classof(const ObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
virtual const std::string getValueName() const
Return name of a LLVM value.
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const SVFVar *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const ValVar *node)
virtual const std::string toString() const
static bool classof(const SVFBaseNode *node)
RetPN(NodeID i)
Constructor to create empty RetPN (for SVFIRReader/deserialization)
RetPN(const SVFFunction *val, NodeID i)
Constructor.
static bool classof(const RetPN *)
static bool isObjVarKinds(GNodeK n)
static bool isValVarKinds(GNodeK n)
GNodeK getNodeKind() const
Get node kind.
NodeID getId() const
Get ID.
static bool isSVFVarKind(GNodeK n)
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
PAGEdgeToSetMapTy KindToSVFStmtMapTy
virtual const SVFType * getType() const
const std::string & getName() const
bool isConstDataOrAggDataButNotNullPtr() const
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap
void addOutEdge(SVFStmt *outEdge)
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap
virtual bool isPointer() const
Whether it is a pointer.
SVFVar(NodeID i, PNODEK k)
whether it is a pointer (top-level or address-taken)
virtual const std::string getValueName() const =0
Get name of the LLVM value.
bool hasIncomingVariantGepEdge() const
Has incoming VariantGepEdges.
bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
Has incoming SVFIR statements (edges)
SVFStmt::SVFStmtSetTy & getIncomingEdges(SVFStmt::PEDGEK kind)
Get incoming SVFIR statements (edges)
virtual const SVFFunction * getFunction() const
Return the function that this SVFVar resides in. Return nullptr if it is a global or constantexpr nod...
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
Get incoming SVFStmt iterator.
SVFStmt::SVFStmtSetTy & getOutgoingEdges(SVFStmt::PEDGEK kind)
Get outgoing SVFIR statements (edges)
void addInEdge(SVFStmt *inEdge)
add methods of the components
bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
Has outgoing SVFIR statements (edges)
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
Get outgoing SVFStmt iterator.
void dump() const
Dump to console for debugging.
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const
Get outgoing SVFStmt iterator.
const SVFValue * value
value of this SVFIR node
virtual const SVFType * getType() const
Return type of the value.
virtual ~SVFVar()
Destructor.
const SVFValue * getValue() const
Get/has methods of the components.
static bool classof(const SVFVar *)
bool isIsolatedNode() const
Whether this is an isolated node on the SVFIR graph.
static bool classof(const SVFBaseNode *node)
virtual const std::string toString() const
friend OutStream & operator<<(OutStream &o, const SVFVar &node)
Overloading operator << for dumping SVFVar value.
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
Get incoming SVFStmt iterator.
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 isBlkObjOrConstantObj(NodeID id)
const SVFType * getFlatternedElemType(const SVFType *baseType, u32_t flatten_idx)
Return the type of a flattened element given a flattened index.
static bool classof(const GenericPAGNodeTy *node)
virtual const std::string toString() const
ValVar(NodeID i, PNODEK ty=ValNode)
Constructor to create an empty ValVar (for SVFIRReader/deserialization)
const SVFBaseNode * gNode
static bool classof(const SVFVar *node)
const SVFBaseNode * getGNode() const
ValVar(const SVFValue *val, NodeID i, PNODEK ty=ValNode, const SVFBaseNode *node=nullptr)
Constructor.
static bool classof(const SVFBaseNode *node)
static bool classof(const ValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const SVFVar *node)
static bool classof(const ValVar *node)
virtual const std::string toString() const
static bool classof(const SVFBaseNode *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const VarArgPN *)
VarArgPN(const SVFFunction *val, NodeID i)
Constructor.
VarArgPN(NodeID i)
Constructor to create empty VarArgPN (for SVFIRReader/deserialization)
const std::string getValueName() const
Return name of a LLVM value.
GenericNode< SVFVar, SVFStmt > GenericPAGNodeTy