30#ifndef INCLUDE_SVFIR_SVFVARIABLE_H_
31#define INCLUDE_SVFIR_SVFVARIABLE_H_
88 "dummy node do not have value!");
90 "blackhole and constant obj do not have value");
91 assert(value &&
"value is null (GepObjNode whose basenode is a DummyObj?)");
103 return value !=
nullptr;
132 if (
auto inst = SVFUtil::dyn_cast<SVFInstruction>(
value))
134 return inst->getParent()->getParent();
137 else if (
auto arg = SVFUtil::dyn_cast<SVFArgument>(
value))
139 return arg->getParent();
162 return (!
it->second.empty());
171 return (!
it->second.empty());
181 return it->second.begin();
189 return it->second.end();
197 return it->second.begin();
205 return it->second.end();
246 for(
auto gep :
it->second)
248 if(SVFUtil::cast<GepStmt>(
gep)->isVariantFieldGep())
256 virtual const std::string
toString()
const;
327 virtual const std::string
toString()
const;
387 virtual const std::string
toString()
const;
463 virtual const std::string
toString()
const;
546 return "offset_" + std::to_string(
apOffset);
549 virtual const std::string
toString()
const;
602 return " (base object)";
605 virtual const std::string
toString()
const;
661 return " (heap base object)";
664 virtual const std::string
toString()
const;
722 return " (stack base object)";
725 virtual const std::string
toString()
const;
772 virtual const std::string
toString()
const;
827 virtual const std::string
toString()
const;
867 virtual const std::string
toString()
const;
908 virtual const std::string
toString()
const;
954 return "BlackHoleVar";
1007 virtual const std::string
toString()
const;
1065 virtual const std::string
toString()
const;
1110 virtual const std::string
toString()
const;
1159 virtual const std::string
toString()
const;
1206 virtual const std::string
toString()
const;
1269 virtual const std::string
toString()
const;
1339 virtual const std::string
toString()
const;
1394 virtual const std::string
toString()
const;
1448 virtual const std::string
toString()
const;
1497 virtual const std::string
toString()
const;
1541 virtual const std::string
toString()
const;
1597 virtual const std::string
toString()
const;
APOffset getConstantStructFldIdx() const
Get methods.
const std::string getValueName() const
Return name of a LLVM value.
virtual const std::string toString() const
BaseObjVar(NodeID i, PNODEK ty=BaseObjNode)
Constructor to create empty ObjVar (for SVFIRReader/deserialization)
static bool classof(const ObjVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const BaseObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
BaseObjVar(const SVFValue *val, NodeID i, const MemObj *mem, PNODEK ty=BaseObjNode)
Constructor.
static bool classof(const SVFVar *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const ConstantDataValVar *node)
static bool classof(const SVFVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const GenericPAGNodeTy *node)
BlackHoleVar(NodeID i, PNODEK ty=BlackHoleNode)
Constructor.
static bool classof(const ValVar *node)
static bool classof(const BlackHoleVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
virtual const std::string toString() const
ConstantDataObjVar(NodeID i)
Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
ConstantDataObjVar(const SVFValue *val, NodeID i, const MemObj *m, PNODEK ty=ConstantDataObjNode)
Constructor.
static bool classof(const ObjVar *node)
virtual const std::string toString() const
static bool classof(const SVFVar *node)
static bool classof(const ConstantDataObjVar *)
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const GenericPAGNodeTy *node)
ConstantDataValVar(const SVFValue *val, NodeID i, const ICFGNode *icn, PNODEK ty=ConstantDataValNode)
Constructor.
static bool classof(const SVFBaseNode *node)
static bool classof(const SVFVar *node)
static bool classof(const ConstantDataValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const ValVar *node)
virtual const std::string toString() const
ConstantFPObjVar(const SVFValue *val, double dv, NodeID i, const MemObj *m, PNODEK ty=ConstantFPObjNode)
Constructor.
static bool classof(const SVFVar *node)
static bool classof(const ObjVar *node)
static bool classof(const ConstantFPObjVar *)
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
ConstantFPObjVar(NodeID i)
Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
virtual const std::string toString() const
static bool classof(const SVFBaseNode *node)
static bool classof(const ConstantDataObjVar *node)
double getFPValue() const
static bool classof(const ValVar *node)
static bool classof(const ConstantDataValVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const SVFVar *node)
static bool classof(const GenericPAGNodeTy *node)
ConstantFPValVar(const SVFValue *val, double dv, NodeID i, const ICFGNode *icn, PNODEK ty=ConstantFPValNode)
Constructor.
virtual const std::string toString() const
static bool classof(const ConstantFPValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
double getFPValue() const
static bool classof(const ConstantDataObjVar *node)
u64_t getZExtValue() const
virtual const std::string toString() const
static bool classof(const ObjVar *node)
s64_t getSExtValue() const
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFVar *node)
static bool classof(const ConstantIntObjVar *)
static bool classof(const SVFBaseNode *node)
static bool classof(const BaseObjVar *node)
ConstantIntObjVar(NodeID i)
Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
ConstantIntObjVar(const SVFValue *val, s64_t sv, u64_t zv, NodeID i, const MemObj *m, PNODEK ty=ConstantIntObjNode)
Constructor.
s64_t getSExtValue() const
static bool classof(const SVFBaseNode *node)
ConstantIntValVar(const SVFValue *val, s64_t sv, u64_t zv, NodeID i, const ICFGNode *icn, PNODEK ty=ConstantIntValNode)
Constructor.
static bool classof(const SVFVar *node)
static bool classof(const ValVar *node)
static bool classof(const ConstantIntValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
u64_t getZExtValue() const
virtual const std::string toString() const
static bool classof(const ConstantDataValVar *node)
static bool classof(const GenericPAGNodeTy *node)
virtual const std::string toString() const
static bool classof(const ObjVar *node)
ConstantNullPtrObjVar(NodeID i)
Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
static bool classof(const GenericPAGNodeTy *node)
ConstantNullPtrObjVar(const SVFValue *val, NodeID i, const MemObj *m, PNODEK ty=ConstantNullptrObjNode)
Constructor.
static bool classof(const ConstantDataObjVar *node)
static bool classof(const SVFVar *node)
static bool classof(const ConstantNullPtrObjVar *)
static bool classof(const BaseObjVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const ConstantDataValVar *node)
virtual const std::string toString() const
static bool classof(const SVFVar *node)
static bool classof(const ConstantNullPtrValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const ValVar *node)
ConstantNullPtrValVar(const SVFValue *val, NodeID i, const ICFGNode *icn, PNODEK ty=ConstantNullptrValNode)
Constructor.
static bool classof(const SVFBaseNode *node)
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)
static bool classof(const BaseObjVar *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)
virtual const std::string toString() const
FunObjVar(NodeID i, PNODEK ty=FunObjNode)
Constructor to create empty ObjVar (for SVFIRReader/deserialization)
virtual bool isIsolatedNode() const
Whether this is an isolated node on the SVFIR graph.
static bool classof(const SVFVar *node)
static bool classof(const BaseObjVar *node)
const CallGraphNode * getCallGraphNode() const
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const FunObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const CallGraphNode * callGraphNode
static bool classof(const ObjVar *node)
static bool classof(const FunValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
virtual const std::string toString() const
const CallGraphNode * callGraphNode
static bool classof(const SVFVar *node)
const CallGraphNode * getCallGraphNode() const
static bool classof(const SVFBaseNode *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const ValVar *node)
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
bool addOutgoingEdge(EdgeType *outEdge)
APOffset getConstantFieldIdx() const
offset of the mem 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.
virtual const SVFType * getType() const
Return the type of this gep object.
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)
static bool classof(const GepValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const SVFType * getType() const
Return type of the value.
const SVFType * gepValType
static bool classof(const SVFVar *node)
GepValVar(NodeID baseID, const SVFValue *val, NodeID i, const AccessPath &ap, const SVFType *ty)
Constructor.
GepValVar(NodeID i)
Constructor to create empty GeValVar (for SVFIRReader/deserialization)
virtual const std::string toString() const
NodeID getBaseNode(void) const
Return the base object from which this GEP node came from.
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)
static bool classof(const BaseObjVar *node)
GlobalObjVar(NodeID i, PNODEK ty=GlobalObjNode)
Constructor to create empty ObjVar (for SVFIRReader/deserialization)
static bool classof(const GenericPAGNodeTy *node)
virtual const std::string toString() const
static bool classof(const SVFVar *node)
GlobalObjVar(const SVFValue *val, NodeID i, const MemObj *mem, PNODEK ty=GlobalObjNode)
Constructor.
static bool classof(const GlobalObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFBaseNode *node)
static bool classof(const ObjVar *node)
static bool classof(const GlobalValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
virtual const std::string toString() const
static bool classof(const ValVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const GenericPAGNodeTy *node)
GlobalValVar(const SVFValue *val, NodeID i, const ICFGNode *icn, PNODEK ty=GlobalValNode)
Constructor.
static bool classof(const SVFVar *node)
Class representing a heap object variable in the SVFIR.
static bool classof(const HeapObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const GenericPAGNodeTy *node)
const std::string getValueName() const
Return name of a LLVM value.
HeapObjVar(NodeID i, PNODEK ty=HeapObjNode)
Constructor to create heap object var.
static bool classof(const ObjVar *node)
virtual const std::string toString() const
static bool classof(const BaseObjVar *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
static bool classof(const GenericPAGNodeTy *node)
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.
const MemObj * getMemObj() const
Return memory object.
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.
virtual const SVFType * getType() const
Return type of the 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)
const CallGraphNode * callGraphNode
virtual const std::string toString() const
static bool classof(const SVFBaseNode *node)
RetPN(NodeID i)
Constructor to create empty RetPN (for SVFIRReader/deserialization)
static bool classof(const RetPN *)
const CallGraphNode * getCallGraphNode() const
virtual const SVFFunction * getFunction() const
static bool isObjVarKinds(GNodeK n)
static bool isConstantDataValVar(GNodeK n)
static bool isConstantDataObjVarKinds(GNodeK n)
static bool isValVarKinds(GNodeK n)
GNodeK getNodeKind() const
Get node kind.
NodeID getId() const
Get ID.
static bool isSVFVarKind(GNodeK n)
static bool isBaseObjVarKinds(GNodeK n)
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
PAGEdgeToSetMapTy KindToSVFStmtMapTy
const std::string & getName() const
virtual const SVFType * getType() const
SVFStmt::SVFStmtSetTy & getOutgoingEdges(SVFStmt::PEDGEK kind)
Get outgoing SVFIR statements (edges)
bool isConstDataOrAggDataButNotNullPtr() const
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap
const SVFValue * getValue() const
Get/has methods of the components.
void addOutEdge(SVFStmt *outEdge)
friend OutStream & operator<<(OutStream &o, const SVFVar &node)
Overloading operator << for dumping SVFVar value.
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap
virtual bool isPointer() const
Whether it is a pointer.
virtual const SVFType * getType() const
Return type of the value.
SVFVar(NodeID i, PNODEK k)
function containing this variable
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)
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
Get incoming SVFStmt iterator.
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.
virtual const SVFFunction * getFunction() const
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
const SVFFunction * func
whether it is a pointer (top-level or address-taken)
virtual ~SVFVar()
Destructor.
static bool classof(const SVFVar *)
virtual 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
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
Get incoming SVFStmt iterator.
static bool classof(const GenericPAGNodeTy *node)
Represents a stack-allocated object variable in the SVFIR (SVF Intermediate Representation) @inherits...
StackObjVar(NodeID i, PNODEK ty=StackObjNode)
Constructor to create stack object var.
static bool classof(const SVFBaseNode *node)
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const SVFVar *node)
static bool classof(const ObjVar *node)
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
virtual const std::string toString() const
static bool classof(const StackObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
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.
const ICFGNode * getICFGNode() const
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)
static bool classof(const SVFVar *node)
static bool classof(const SVFBaseNode *node)
static bool classof(const ValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const ICFGNode * icfgNode
const std::string getValueName() const
Return name of a LLVM value.
ValVar(const SVFValue *val, NodeID i, PNODEK ty=ValNode, const ICFGNode *node=nullptr)
Constructor.
const CallGraphNode * callGraphNode
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)
VarArgPN(const CallGraphNode *node, NodeID i)
Constructor.
static bool classof(const GenericPAGNodeTy *node)
virtual const SVFFunction * getFunction() const
static bool classof(const VarArgPN *)
VarArgPN(NodeID i)
Constructor to create empty VarArgPN (for SVFIRReader/deserialization)
GenericNode< SVFVar, SVFStmt > GenericPAGNodeTy
llvm::IRBuilder IRBuilder