Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
SVF::SVFIR Class Reference

#include <SVFIR.h>

Inheritance diagram for SVF::SVFIR:
SVF::IRGraph SVF::GenericGraph< SVFVar, SVFStmt >

Public Types

typedef Set< const CallICFGNode * > CallSiteSet
 
typedef OrderedMap< const CallICFGNode *, NodeIDCallSiteToFunPtrMap
 
typedef Map< NodeID, CallSiteSetFunPtrToCallSitesMap
 
typedef Map< NodeID, NodeBSMemObjToFieldsMap
 
typedef std::vector< const SVFStmt * > SVFStmtList
 
typedef std::vector< const SVFVar * > SVFVarList
 
typedef Map< const SVFVar *, PhiStmt * > PHINodeMap
 
typedef Map< const FunObjVar *, SVFVarListFunToArgsListMap
 
typedef Map< const CallICFGNode *, SVFVarListCSToArgsListMap
 
typedef Map< const RetICFGNode *, const SVFVar * > CSToRetMap
 
typedef Map< const FunObjVar *, const SVFVar * > FunToRetMap
 
typedef Map< const FunObjVar *, SVFStmtSetFunToPAGEdgeSetMap
 
typedef Map< const ICFGNode *, SVFStmtListICFGNode2SVFStmtsMap
 
typedef Map< NodeID, NodeIDNodeToNodeMap
 
typedef std::pair< NodeID, APOffsetNodeOffset
 
typedef std::pair< NodeID, AccessPathNodeAccessPath
 
typedef Map< NodeOffset, NodeIDNodeOffsetMap
 
typedef Map< NodeAccessPath, NodeIDNodeAccessPathMap
 
typedef Map< NodeID, NodeAccessPathMapGepValueVarMap
 
typedef std::pair< const SVFType *, std::vector< AccessPath > > SVFTypeLocSetsPair
 
typedef Map< NodeID, SVFTypeLocSetsPairTypeLocSetsMap
 
typedef Map< NodePair, NodeIDNodePairSetMap
 
- Public Types inherited from SVF::IRGraph
enum  SYMTYPE {
  NullPtr , BlkPtr , BlackHole , ConstantObj ,
  ValSymbol , ObjSymbol , RetSymbol , VarargSymbol
}
 Symbol types. More...
 
typedef OrderedMap< NodeID, ObjTypeInfo * > IDToTypeInfoMapTy
 various maps defined
 
typedef OrderedMap< const FunObjVar *, NodeIDFunObjVarToIDMapTy
 function to sym id map
 
typedef Set< const SVFType * > SVFTypeSet
 struct type to struct info map
 
typedef Set< const SVFStmt * > SVFStmtSet
 
- Public Types inherited from SVF::GenericGraph< SVFVar, SVFStmt >
typedef SVFVar NodeType
 
typedef SVFStmt EdgeType
 
typedef OrderedMap< NodeID, NodeType * > IDToNodeMapTy
 NodeID to GenericNode map.
 
typedef IDToNodeMapTy::iterator iterator
 Node Iterators.
 
typedef IDToNodeMapTy::const_iterator const_iterator
 

Public Member Functions

MemObjToFieldsMapgetMemToFieldsMap ()
 Return memToFieldsMap.
 
NodeOffsetMapgetGepObjNodeMap ()
 Return GepObjVarMap.
 
OrderedNodeSetgetAllValidPtrs ()
 Return valid pointers.
 
void initialiseCandidatePointers ()
 Initialize candidate pointers.
 
virtual ~SVFIR ()
 Destructor.
 
void setICFG (ICFG *i)
 Set/Get ICFG.
 
ICFGgetICFG () const
 
void setCHG (CommonCHGraph *c)
 Set/Get CHG.
 
CommonCHGraphgetCHG ()
 
const CallGraphgetCallGraph ()
 Get CG.
 
void setCallGraph (CallGraph *cg)
 
const FunObjVargetFunObjVar (const std::string &name)
 
const std::string & getModuleIdentifier () const
 
void setModuleIdentifier (const std::string &moduleIdentifier)
 
SVFStmt::SVFStmtSetTygetSVFStmtSet (SVFStmt::PEDGEK kind)
 Get/set methods to get SVFStmts based on their kinds and ICFGNodes.
 
SVFStmt::SVFStmtSetTygetPTASVFStmtSet (SVFStmt::PEDGEK kind)
 Get PTA edges set according to its kind.
 
bool hasSVFStmtList (const ICFGNode *inst) const
 Whether this instruction has SVFIR Edge.
 
bool hasPTASVFStmtList (const ICFGNode *inst) const
 
SVFStmtListgetSVFStmtList (const ICFGNode *inst)
 Given an instruction, get all its PAGEdges.
 
SVFStmtListgetPTASVFStmtList (const ICFGNode *inst)
 Given an instruction, get all its PTA PAGEdges.
 
void addToSVFStmtList (ICFGNode *inst, SVFStmt *edge)
 Add a SVFStmt into instruction map.
 
void addToTypeLocSetsMap (NodeID argId, SVFTypeLocSetsPair &locSets)
 Add a base SVFType* and all its field location sets to an arg NodeId.
 
SVFTypeLocSetsPairgetTypeLocSetsMap (NodeID argId)
 Given an arg NodeId, get its base SVFType* and all its field location sets.
 
SVFStmtSetgetGlobalSVFStmtSet ()
 Get global PAGEdges (not in a procedure)
 
const CallSiteSetgetCallSiteSet () const
 Get all callsites.
 
bool isPhiNode (const SVFVar *node) const
 Whether this SVFVar is a result operand a of phi node.
 
bool hasFunArgsList (const FunObjVar *func) const
 Function has arguments list.
 
FunToArgsListMapgetFunArgsMap ()
 Get function arguments list.
 
const SVFVarListgetFunArgsList (const FunObjVar *func) const
 Get function arguments list.
 
bool hasCallSiteArgsMap (const CallICFGNode *cs) const
 Callsite has argument list.
 
CSToArgsListMapgetCallSiteArgsMap ()
 Get callsite argument list.
 
const SVFVarListgetCallSiteArgsList (const CallICFGNode *cs) const
 Get callsite argument list.
 
CSToRetMapgetCallSiteRets ()
 Get callsite return.
 
const SVFVargetCallSiteRet (const RetICFGNode *cs) const
 Get callsite return.
 
bool callsiteHasRet (const RetICFGNode *cs) const
 
FunToRetMapgetFunRets ()
 Get function return list.
 
const SVFVargetFunRet (const FunObjVar *func) const
 Get function return list.
 
bool funHasRet (const FunObjVar *func) const
 
u32_t getFieldValNodeNum () const
 Node and edge statistics.
 
u32_t getFieldObjNodeNum () const
 
NodeID getGepValVar (NodeID curInst, NodeID base, const AccessPath &ap) const
 Due to constraint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
 
const CallSiteToFunPtrMapgetIndirectCallsites () const
 Add/get indirect callsites.
 
NodeID getFunPtr (const CallICFGNode *cs) const
 
const CallSiteSetgetIndCallSites (NodeID funPtr) const
 
bool isIndirectCallSites (const CallICFGNode *cs) const
 
bool isFunPtr (NodeID id) const
 
SVFStmtgetIntraPAGEdge (NodeID src, NodeID dst, SVFStmt::PEDGEK kind)
 Get an edge according to src, dst and kind.
 
SVFStmtgetIntraPAGEdge (SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind)
 
const BaseObjVargetBaseObject (NodeID id) const
 
const ValVargetBaseValVar (NodeID id) const
 
NodeID getGepObjVar (const BaseObjVar *baseObj, const APOffset &ap)
 Get a field SVFIR Object node according to base mem obj and offset.
 
NodeID getGepObjVar (NodeID id, const APOffset &ap)
 Get a field obj SVFIR node according to a mem obj and a given offset.
 
NodeID getFIObjVar (const BaseObjVar *obj) const
 Get a field-insensitive obj SVFIR node according to a mem obj.
 
NodeID getFIObjVar (NodeID id) const
 
bool isBlkObjOrConstantObj (NodeID id) const
 Get black hole and constant id.
 
bool isConstantObj (NodeID id) const
 
NodeID getBaseObjVar (NodeID id) const
 Base and Offset methods for Value and Object node.
 
NodeBSgetAllFieldsObjVars (const BaseObjVar *obj)
 Get all fields of an object.
 
NodeBSgetAllFieldsObjVars (NodeID id)
 
NodeBS getFieldsAfterCollapse (NodeID id)
 
NodeID addDummyValNode ()
 
NodeID addDummyObjNode (const SVFType *type)
 
bool isValidPointer (NodeID nodeId) const
 Whether a node is a valid pointer.
 
bool isValidTopLevelPtr (const SVFVar *node)
 
void print ()
 Print SVFIR.
 
- Public Member Functions inherited from SVF::IRGraph
 IRGraph (bool buildFromFile)
 
virtual ~IRGraph ()
 
bool isBuiltFromFile ()
 Whether this SVFIR built from a txt file.
 
NodeID blkPtrSymID () const
 
NodeID nullPtrSymID () const
 
NodeID constantSymID () const
 
NodeID blackholeSymID () const
 
u32_t getTotalSymNum () const
 Statistics.
 
u32_t getMaxStructSize () const
 
IDToTypeInfoMapTyidToObjTypeInfoMap ()
 Get different kinds of syms maps.
 
const IDToTypeInfoMapTyidToObjTypeInfoMap () const
 
FunObjVarToIDMapTyretFunObjSyms ()
 
FunObjVarToIDMapTyvarargFunObjSyms ()
 
ObjTypeInfogetObjTypeInfo (NodeID id) const
 
NodeID getReturnNode (const FunObjVar *func) const
 GetReturnNode - Return the unique node representing the return value of a function.
 
NodeID getVarargNode (const FunObjVar *func) const
 getVarargNode - Return the unique node representing the variadic argument of a variadic function.
 
NodeID getBlackHoleNode () const
 
NodeID getConstantNode () const
 
NodeID getBlkPtr () const
 
NodeID getNullPtr () const
 
u32_t getValueNodeNum ()
 
u32_t getObjectNodeNum ()
 
const SVFTypeSetgetSVFTypes () const
 Constant reader that won't change the state of the symbol table.
 
const SVFTypegetSVFType (u32_t id) const
 
const Set< const StInfo * > & getStInfos () const
 
virtual APOffset getModulusOffset (const BaseObjVar *baseObj, const APOffset &apOffset)
 Given an offset from a Gep Instruction, return it modulus offset by considering memory layout.
 
const StInfogetTypeInfo (const SVFType *T) const
 Get struct info.
 
bool hasSVFTypeInfo (const SVFType *T)
 
ObjTypeInfocreateObjTypeInfo (const SVFType *type)
 Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
 
const ObjTypeInfocreateDummyObjTypeInfo (NodeID symId, const SVFType *type)
 
u32_t getNumOfFlattenElements (const SVFType *T)
 
u32_t getFlattenedElemIdx (const SVFType *T, u32_t origId)
 Flattened element idx of an array or struct by considering stride.
 
const SVFTypegetFlatternedElemType (const SVFType *baseType, u32_t flatten_idx)
 Return the type of a flattened element given a flattened index.
 
const SVFTypegetOriginalElemType (const SVFType *baseType, u32_t origId) const
 
void printFlattenFields (const SVFType *type)
 Debug method.
 
u32_t getNodeNumAfterPAGBuild () const
 
void setNodeNumAfterPAGBuild (u32_t num)
 
u32_t getPAGNodeNum () const
 
u32_t getPAGEdgeNum () const
 
u32_t getPTAPAGEdgeNum () const
 
std::string getGraphName () const
 Return graph name.
 
void dumpSymTable ()
 
void dump (std::string name)
 Dump SVFIR.
 
void view ()
 View graph from the debugger.
 
void addTypeInfo (const SVFType *ty)
 
void addStInfo (StInfo *stInfo)
 
- Public Member Functions inherited from SVF::GenericGraph< SVFVar, SVFStmt >
 GenericGraph ()
 Constructor.
 
virtual ~GenericGraph ()
 Destructor.
 
void destroy ()
 Release memory.
 
iterator begin ()
 Iterators.
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void addGNode (NodeID id, NodeType *node)
 Add a Node.
 
NodeTypegetGNode (NodeID id) const
 Get a node.
 
bool hasGNode (NodeID id) const
 Has a node.
 
void removeGNode (NodeType *node)
 Delete a node.
 
u32_t getTotalNodeNum () const
 Get total number of node/edge.
 
u32_t getTotalEdgeNum () const
 
void incNodeNum ()
 Increase number of node/edge.
 
void incEdgeNum ()
 

Static Public Member Functions

static SVFIRgetPAG (bool buildFromFile=false)
 Singleton design here to make sure we only have one instance during any analysis.
 
static void releaseSVFIR ()
 
static void handleBlackHole (bool b)
 SVFIR build configurations.
 
static std::string pagFileName ()
 
static bool pagReadFromTXT ()
 
static void setPagFromTXT (const std::string &txt)
 
- Static Public Member Functions inherited from SVF::IRGraph
static bool isBlkPtr (NodeID id)
 special value
 
static bool isNullPtr (NodeID id)
 
static bool isBlkObj (NodeID id)
 
static bool isConstantSym (NodeID id)
 
static bool isBlkObjOrConstantObj (NodeID id)
 

Protected Member Functions

NodeID addBaseObjNode (BaseObjVar *node)
 
NodeID addDummyObjNode (DummyObjVar *node)
 
NodeID addGepObjNode (GepObjVar *gepObj, NodeID base, const APOffset &apOffset)
 
void addGepValObjFromDB (NodeID curInstID, const GepValVar *gepValvar)
 
- Protected Member Functions inherited from SVF::IRGraph
NodeID addNode (SVFVar *node)
 Add a node into the graph.
 
bool addEdge (SVFVar *src, SVFVar *dst, SVFStmt *edge)
 Add an edge into the graph.
 
SVFStmthasNonlabeledEdge (SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind)
 
SVFStmthasLabeledEdge (SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind, const ICFGNode *cs)
 
SVFStmthasEdge (SVFStmt *edge, SVFStmt::PEDGEK kind)
 
SVFStmthasLabeledEdge (SVFVar *src, SVFVar *op1, SVFStmt::PEDGEK kind, const SVFVar *op2)
 
const std::vector< const SVFType * > & getFlattenFieldTypes (const SVFStructType *T)
 Return the flattened field type for struct type only.
 

Private Member Functions

 SVFIR (bool buildFromFile)
 Constructor.
 
void destroy ()
 Clean up memory.
 
void addToStmt2TypeMap (SVFStmt *edge)
 Map a SVFStatement type to a set of corresponding SVF statements.
 
void addFunArgs (const FunObjVar *fun, const SVFVar *arg)
 Get/set method for function/callsite arguments and returns.
 
void addFunArgs (FunEntryICFGNode *funEntryBlockNode, const FunObjVar *fun, const SVFVar *arg)
 
void addFunRet (const FunObjVar *fun, const SVFVar *ret)
 Add function returns.
 
void addFunRet (FunExitICFGNode *funExitBlockNode, const FunObjVar *fun, const SVFVar *ret)
 
void addCallSiteArgs (CallICFGNode *callBlockNode, const ValVar *arg)
 Add callsite arguments.
 
void addCallSiteRets (RetICFGNode *retBlockNode, const SVFVar *arg)
 Add callsite returns.
 
void addIndirectCallsites (const CallICFGNode *cs, NodeID funPtr)
 Add indirect callsites.
 
NodeID addValNode (NodeID i, const SVFType *type, const ICFGNode *icfgNode)
 add node into SVFIR
 
NodeID addFunValNode (NodeID i, const ICFGNode *icfgNode, const FunObjVar *funObjVar, const SVFType *type)
 
NodeID addArgValNode (NodeID i, u32_t argNo, const ICFGNode *icfgNode, const FunObjVar *callGraphNode, const SVFType *type)
 
NodeID addConstantFPValNode (const NodeID i, double dval, const ICFGNode *icfgNode, const SVFType *type)
 
NodeID addConstantIntValNode (NodeID i, const std::pair< s64_t, u64_t > &intValue, const ICFGNode *icfgNode, const SVFType *type)
 
NodeID addConstantNullPtrValNode (const NodeID i, const ICFGNode *icfgNode, const SVFType *type)
 
NodeID addGlobalValNode (const NodeID i, const ICFGNode *icfgNode, const SVFType *svfType)
 
NodeID addConstantAggValNode (const NodeID i, const ICFGNode *icfgNode, const SVFType *svfType)
 
NodeID addConstantDataValNode (const NodeID i, const ICFGNode *icfgNode, const SVFType *type)
 
NodeID addObjNode (NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
 Add a memory obj node.
 
NodeID addHeapObjNode (NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
 
NodeID addStackObjNode (NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
 
NodeID addFunObjNode (NodeID id, ObjTypeInfo *ti, const ICFGNode *node)
 
NodeID addConstantFPObjNode (NodeID i, ObjTypeInfo *ti, double dval, const ICFGNode *node)
 
NodeID addConstantIntObjNode (NodeID i, ObjTypeInfo *ti, const std::pair< s64_t, u64_t > &intValue, const ICFGNode *node)
 
NodeID addConstantNullPtrObjNode (const NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
 
NodeID addGlobalObjNode (const NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
 
NodeID addConstantAggObjNode (const NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
 
NodeID addConstantDataObjNode (const NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
 
NodeID addRetNode (NodeID i, const FunObjVar *callGraphNode, const SVFType *type, const ICFGNode *icn)
 Add a unique return node for a procedure.
 
NodeID addVarargNode (NodeID i, const FunObjVar *val, const SVFType *type, const ICFGNode *n)
 Add a unique vararg node for a procedure.
 
NodeID addGepValNode (NodeID curInst, const ValVar *base, const AccessPath &ap, NodeID i, const SVFType *type, const ICFGNode *node)
 Add a temp field value node, this method can only invoked by getGepValVar.
 
NodeID addGepObjNode (const BaseObjVar *baseObj, const APOffset &apOffset, const NodeID gepId)
 Add a field obj node, this method can only invoked by getGepObjVar.
 
NodeID addFIObjNode (NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
 Add a field-insensitive node, this method can only invoked by getFIGepObjNode.
 
NodeID addDummyValNode (NodeID i, const ICFGNode *node)
 Add a dummy value/object node according to node ID (llvm value is null)
 
NodeID addDummyObjNode (NodeID i, const SVFType *type)
 
NodeID addBlackholeObjNode ()
 
NodeID addConstantObjNode ()
 
NodeID addBlackholePtrNode ()
 
NodeID addValNode (ValVar *node)
 Add a value (pointer) node.
 
NodeID addObjNode (ObjVar *node)
 Add a memory obj node.
 
NodeID addRetNode (const FunObjVar *, SVFVar *node)
 Add a unique return node for a procedure.
 
NodeID addVarargNode (const FunObjVar *, SVFVar *node)
 Add a unique vararg node for a procedure.
 
void addGlobalPAGEdge (const SVFStmt *edge)
 Add global PAGEdges (not in a procedure)
 
void addCallSite (const CallICFGNode *call)
 Add callsites.
 
AddrStmtaddAddrStmt (NodeID src, NodeID dst)
 Add an edge into SVFIR.
 
void addAddrStmt (AddrStmt *edge)
 
CopyStmtaddCopyStmt (NodeID src, NodeID dst, CopyStmt::CopyKind type)
 Add Copy edge.
 
void addCopyStmt (CopyStmt *edge)
 
PhiStmtaddPhiStmt (NodeID res, NodeID opnd, const ICFGNode *pred)
 Add phi node information.
 
void addPhiStmt (PhiStmt *edge, SVFVar *src, SVFVar *dst)
 
SelectStmtaddSelectStmt (NodeID res, NodeID op1, NodeID op2, NodeID cond)
 Add SelectStmt.
 
void addSelectStmt (SelectStmt *edge, SVFVar *src, SVFVar *dst)
 
CmpStmtaddCmpStmt (NodeID op1, NodeID op2, NodeID dst, u32_t predict)
 Add Copy edge.
 
void addCmpStmt (CmpStmt *edge, SVFVar *src, SVFVar *dst)
 
BinaryOPStmtaddBinaryOPStmt (NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
 Add Copy edge.
 
void addBinaryOPStmt (BinaryOPStmt *edge, SVFVar *src, SVFVar *dst)
 
UnaryOPStmtaddUnaryOPStmt (NodeID src, NodeID dst, u32_t opcode)
 Add Unary edge.
 
void addUnaryOPStmt (UnaryOPStmt *edge, SVFVar *src, SVFVar *dst)
 
BranchStmtaddBranchStmt (NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec &succs)
 Add BranchStmt.
 
void addBranchStmt (BranchStmt *edge, SVFVar *src, SVFVar *dst)
 
LoadStmtaddLoadStmt (NodeID src, NodeID dst)
 Add Load edge.
 
void addLoadStmt (LoadStmt *edge)
 
StoreStmtaddStoreStmt (NodeID src, NodeID dst, const ICFGNode *val)
 Add Store edge.
 
void addStoreStmt (StoreStmt *edge, SVFVar *src, SVFVar *dst)
 
CallPEaddCallPE (NodeID src, NodeID dst, const CallICFGNode *cs, const FunEntryICFGNode *entry)
 Add Call edge.
 
void addCallPE (CallPE *edge, SVFVar *src, SVFVar *dst)
 
RetPEaddRetPE (NodeID src, NodeID dst, const CallICFGNode *cs, const FunExitICFGNode *exit)
 Add Return edge.
 
void addRetPE (RetPE *edge, SVFVar *src, SVFVar *dst)
 
GepStmtaddGepStmt (NodeID src, NodeID dst, const AccessPath &ap, bool constGep)
 Add Gep edge.
 
void addGepStmt (GepStmt *edge)
 
GepStmtaddNormalGepStmt (NodeID src, NodeID dst, const AccessPath &ap)
 Add Offset(Gep) edge.
 
GepStmtaddVariantGepStmt (NodeID src, NodeID dst, const AccessPath &ap)
 Add Variant(Gep) edge.
 
TDForkPEaddThreadForkPE (NodeID src, NodeID dst, const CallICFGNode *cs, const FunEntryICFGNode *entry)
 Add Thread fork edge for parameter passing.
 
TDJoinPEaddThreadJoinPE (NodeID src, NodeID dst, const CallICFGNode *cs, const FunExitICFGNode *exit)
 Add Thread join edge for parameter passing.
 
SVFStmtaddBlackHoleAddrStmt (NodeID node)
 Set a pointer points-to black hole (e.g. int2ptr)
 

Private Attributes

ICFGNode2SVFStmtsMap icfgNode2SVFStmtsMap
 Map an ICFGNode to its SVFStmts.
 
ICFGNode2SVFStmtsMap icfgNode2PTASVFStmtsMap
 Map an ICFGNode to its PointerAnalysis related SVFStmts.
 
GepValueVarMap GepValObjMap
 Map a pair<base,off> to a gep value node id.
 
TypeLocSetsMap typeLocSetsMap
 Map an arg to its base SVFType* and all its field location sets.
 
NodeOffsetMap GepObjVarMap
 Map a pair<base,off> to a gep obj node id.
 
MemObjToFieldsMap memToFieldsMap
 Map a mem object id to all its fields.
 
SVFStmtSet globSVFStmtSet
 Global PAGEdges without control flow information.
 
PHINodeMap phiNodeMap
 A set of phi copy edges.
 
FunToArgsListMap funArgsListMap
 Map a function to a list of all its formal parameters.
 
CSToArgsListMap callSiteArgsListMap
 Map a callsite to a list of all its actual parameters.
 
CSToRetMap callSiteRetMap
 Map a callsite to its callsite returns PAGNodes.
 
FunToRetMap funRetMap
 Map a function to its unique function return PAGNodes.
 
CallSiteToFunPtrMap indCallSiteToFunPtrMap
 Map an indirect callsite to its function pointer.
 
FunPtrToCallSitesMap funPtrToCallSitesMap
 
OrderedNodeSet candidatePointers
 
ICFGicfg
 
CommonCHGraphchgraph
 
CallSiteSet callSiteSet
 
CallGraphcallGraph
 all the callsites of a program
 
std::string moduleIdentifier
 

Static Private Attributes

static std::unique_ptr< SVFIRpag
 Callgraph with direct calls only; no change allowed after init and use callgraph in PointerAnalysis for indirect calls)
 
static std::string pagReadFromTxt = ""
 

Friends

class SVFIRBuilder
 
class ExternalPAG
 
class PAGBuilderFromFile
 
class TypeBasedHeapCloning
 
class BVDataPTAImpl
 
class GraphDBClient
 
class GraphDBSVFIRBuilder
 

Additional Inherited Members

- Public Attributes inherited from SVF::IRGraph
const SVFTypemaxStruct
 The struct type with the most fields.
 
u32_t maxStSize
 The number of fields in max_struct.
 
- Public Attributes inherited from SVF::GenericGraph< SVFVar, SVFStmt >
u32_t edgeNum
 total num of node
 
u32_t nodeNum
 total num of edge
 
- Protected Attributes inherited from SVF::IRGraph
SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap
 SVFIR edge map containing all PAGEdges.
 
SVFStmt::KindToSVFStmtMapTy KindToPTASVFStmtSetMap
 SVFIR edge map containing only pointer-related edges, i.e., both LHS and RHS are of pointer type.
 
bool fromFile
 Whether the SVFIR is built according to user specified data from a txt file.
 
NodeID nodeNumAfterPAGBuild
 initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
 
u32_t totalPTAPAGEdge
 
u32_t valVarNum
 
u32_t objVarNum
 
- Protected Attributes inherited from SVF::GenericGraph< SVFVar, SVFStmt >
IDToNodeMapTy IDToNodeMap
 node map
 

Detailed Description

SVF Intermediate representation, representing variables and statements as a Program Assignment Graph (PAG) Variables as nodes and statements as edges.

Definition at line 42 of file SVFIR.h.

Member Typedef Documentation

◆ CallSiteSet

Definition at line 53 of file SVFIR.h.

◆ CallSiteToFunPtrMap

Definition at line 54 of file SVFIR.h.

◆ CSToArgsListMap

Definition at line 61 of file SVFIR.h.

◆ CSToRetMap

Definition at line 62 of file SVFIR.h.

◆ FunPtrToCallSitesMap

Definition at line 55 of file SVFIR.h.

◆ FunToArgsListMap

Definition at line 60 of file SVFIR.h.

◆ FunToPAGEdgeSetMap

Definition at line 64 of file SVFIR.h.

◆ FunToRetMap

Definition at line 63 of file SVFIR.h.

◆ GepValueVarMap

Definition at line 71 of file SVFIR.h.

◆ ICFGNode2SVFStmtsMap

Definition at line 65 of file SVFIR.h.

◆ MemObjToFieldsMap

Definition at line 56 of file SVFIR.h.

◆ NodeAccessPath

Definition at line 68 of file SVFIR.h.

◆ NodeAccessPathMap

Definition at line 70 of file SVFIR.h.

◆ NodeOffset

Definition at line 67 of file SVFIR.h.

◆ NodeOffsetMap

Definition at line 69 of file SVFIR.h.

◆ NodePairSetMap

Definition at line 74 of file SVFIR.h.

◆ NodeToNodeMap

Definition at line 66 of file SVFIR.h.

◆ PHINodeMap

Definition at line 59 of file SVFIR.h.

◆ SVFStmtList

Definition at line 57 of file SVFIR.h.

◆ SVFTypeLocSetsPair

Definition at line 72 of file SVFIR.h.

◆ SVFVarList

Definition at line 58 of file SVFIR.h.

◆ TypeLocSetsMap

Definition at line 73 of file SVFIR.h.

Constructor & Destructor Documentation

◆ SVFIR()

SVFIR::SVFIR ( bool  buildFromFile)
private

Constructor.

Definition at line 42 of file SVFIR.cpp.

42 : IRGraph(buildFromFile), icfg(nullptr), chgraph(nullptr)
43{
44}
CommonCHGraph * chgraph
Definition SVFIR.h:97
ICFG * icfg
Definition SVFIR.h:96
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~SVFIR()

virtual SVF::SVFIR::~SVFIR ( )
inlinevirtual

Destructor.

Definition at line 148 of file SVFIR.h.

149 {
150 destroy();
151 }
void destroy()
Clean up memory.
Definition SVFIR.cpp:619

Member Function Documentation

◆ addAddrStmt() [1/2]

void SVFIR::addAddrStmt ( AddrStmt edge)
private

Definition at line 76 of file SVFIR.cpp.

77{
79 addEdge(edge->getRHSVar(),edge->getLHSVar(), edge);
80}
bool addEdge(SVFVar *src, SVFVar *dst, SVFStmt *edge)
Add an edge into the graph.
Definition IRGraph.cpp:253
void addToStmt2TypeMap(SVFStmt *edge)
Map a SVFStatement type to a set of corresponding SVF statements.
Definition SVFIR.h:529

◆ addAddrStmt() [2/2]

AddrStmt * SVFIR::addAddrStmt ( NodeID  src,
NodeID  dst 
)
private

Add an edge into SVFIR.

Add Address edge

Definition at line 63 of file SVFIR.cpp.

64{
65 SVFVar* srcNode = getGNode(src);
66 SVFVar* dstNode = getGNode(dst);
68 return nullptr;
69 else
70 {
73 return addrPE;
74 }
75}
NodeType * getGNode(NodeID id) const
Get a node.
SVFStmt * hasNonlabeledEdge(SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind)
Definition IRGraph.cpp:268
AddrStmt * addAddrStmt(NodeID src, NodeID dst)
Add an edge into SVFIR.
Definition SVFIR.cpp:63

◆ addArgValNode()

NodeID SVF::SVFIR::addArgValNode ( NodeID  i,
u32_t  argNo,
const ICFGNode icfgNode,
const FunObjVar callGraphNode,
const SVFType type 
)
inlineprivate

Definition at line 603 of file SVFIR.h.

604 {
605 ArgValVar* node =
606 new ArgValVar(i, argNo, icfgNode, callGraphNode, type);
607 return addValNode(node);
608 }
newitem type
Definition cJSON.cpp:2739
NodeID addValNode(NodeID i, const SVFType *type, const ICFGNode *icfgNode)
add node into SVFIR
Definition SVFIR.h:591

◆ addBaseObjNode()

NodeID SVF::SVFIR::addBaseObjNode ( BaseObjVar node)
inlineprotected

Definition at line 511 of file SVFIR.h.

512 {
513 memToFieldsMap[node->getId()].set(node->getId());
514 return addObjNode(node);
515 }
MemObjToFieldsMap memToFieldsMap
Map a mem object id to all its fields.
Definition SVFIR.h:84
NodeID addObjNode(NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
Add a memory obj node.
Definition SVFIR.h:650

◆ addBinaryOPStmt() [1/2]

void SVFIR::addBinaryOPStmt ( BinaryOPStmt edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 209 of file SVFIR.cpp.

210{
212 addEdge(src, dst, edge);
213}

◆ addBinaryOPStmt() [2/2]

BinaryOPStmt * SVFIR::addBinaryOPStmt ( NodeID  op1,
NodeID  op2,
NodeID  dst,
u32_t  opcode 
)
private

Add Copy edge.

Add Compare edge

Definition at line 193 of file SVFIR.cpp.

194{
197 SVFVar* dstNode = getGNode(dst);
199 return nullptr;
200 else
201 {
202 std::vector<SVFVar*> opnds = {op1Node, op2Node};
205 return binaryOP;
206 }
207}
SVFStmt * hasLabeledEdge(SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind, const ICFGNode *cs)
Definition IRGraph.cpp:291
BinaryOPStmt * addBinaryOPStmt(NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
Add Copy edge.
Definition SVFIR.cpp:193

◆ addBlackHoleAddrStmt()

SVFStmt * SVFIR::addBlackHoleAddrStmt ( NodeID  node)
private

Set a pointer points-to black hole (e.g. int2ptr)

Add blackhole/constant edge

Definition at line 356 of file SVFIR.cpp.

357{
359 return pag->addAddrStmt(pag->getBlackHoleNode(), node);
360 else
361 return pag->addCopyStmt(pag->getNullPtr(), node, CopyStmt::COPYVAL);
362}
static Option< bool > HandBlackHole
Definition Options.h:99
static std::unique_ptr< SVFIR > pag
Callgraph with direct calls only; no change allowed after init and use callgraph in PointerAnalysis f...
Definition SVFIR.h:101

◆ addBlackholeObjNode()

NodeID SVF::SVFIR::addBlackholeObjNode ( )
inlineprivate

Definition at line 764 of file SVFIR.h.

765 {
766 return addObjNode(new DummyObjVar(getBlackHoleNode(), getObjTypeInfo(getBlackHoleNode()), nullptr));
767 }
NodeID getBlackHoleNode() const
Definition IRGraph.h:247
ObjTypeInfo * getObjTypeInfo(NodeID id) const
Definition IRGraph.h:234

◆ addBlackholePtrNode()

NodeID SVF::SVFIR::addBlackholePtrNode ( )
inlineprivate

Definition at line 772 of file SVFIR.h.

773 {
774 return addDummyValNode(getBlkPtr(), nullptr);
775 }
NodeID getBlkPtr() const
Definition IRGraph.h:255
NodeID addDummyValNode()
Definition SVFIR.h:492

◆ addBranchStmt() [1/2]

void SVFIR::addBranchStmt ( BranchStmt edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 254 of file SVFIR.cpp.

255{
257 addEdge(src, dst, edge);
258}

◆ addBranchStmt() [2/2]

BranchStmt * SVFIR::addBranchStmt ( NodeID  br,
NodeID  cond,
const BranchStmt::SuccAndCondPairVec succs 
)
private

Add BranchStmt.

Definition at line 240 of file SVFIR.cpp.

241{
243 SVFVar* condNode = getGNode(cond);
245 return nullptr;
246 else
247 {
250 return branch;
251 }
252}
BranchStmt * addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec &succs)
Add BranchStmt.
Definition SVFIR.cpp:240

◆ addCallPE() [1/2]

void SVFIR::addCallPE ( CallPE edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 324 of file SVFIR.cpp.

325{
327 addEdge(src,dst, edge);
328}

◆ addCallPE() [2/2]

CallPE * SVFIR::addCallPE ( NodeID  src,
NodeID  dst,
const CallICFGNode cs,
const FunEntryICFGNode entry 
)
private

Add Call edge.

Add Call edge

Definition at line 310 of file SVFIR.cpp.

311{
312 SVFVar* srcNode = getGNode(src);
313 SVFVar* dstNode = getGNode(dst);
315 return nullptr;
316 else
317 {
318 CallPE* callPE = new CallPE(srcNode, dstNode, cs,entry);
320 return callPE;
321 }
322}
CallPE * addCallPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunEntryICFGNode *entry)
Add Call edge.
Definition SVFIR.cpp:310

◆ addCallSite()

void SVF::SVFIR::addCallSite ( const CallICFGNode call)
inlineprivate

Add callsites.

Definition at line 799 of file SVFIR.h.

800 {
801 callSiteSet.insert(call);
802 }
CallSiteSet callSiteSet
Definition SVFIR.h:98

◆ addCallSiteArgs()

void SVF::SVFIR::addCallSiteArgs ( CallICFGNode callBlockNode,
const ValVar arg 
)
inlineprivate

Add callsite arguments.

Definition at line 568 of file SVFIR.h.

569 {
570 callBlockNode->addActualParms(arg);
571 callSiteArgsListMap[callBlockNode].push_back(arg);
572 }
CSToArgsListMap callSiteArgsListMap
Map a callsite to a list of all its actual parameters.
Definition SVFIR.h:88

◆ addCallSiteRets()

void SVF::SVFIR::addCallSiteRets ( RetICFGNode retBlockNode,
const SVFVar arg 
)
inlineprivate

Add callsite returns.

Definition at line 574 of file SVFIR.h.

575 {
576 retBlockNode->addActualRet(arg);
578 }
CSToRetMap callSiteRetMap
Map a callsite to its callsite returns PAGNodes.
Definition SVFIR.h:89

◆ addCmpStmt() [1/2]

void SVFIR::addCmpStmt ( CmpStmt edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 183 of file SVFIR.cpp.

184{
186 addEdge(src, dst, edge);
187}

◆ addCmpStmt() [2/2]

CmpStmt * SVFIR::addCmpStmt ( NodeID  op1,
NodeID  op2,
NodeID  dst,
u32_t  predicate 
)
private

Add Copy edge.

Add Compare edge

Definition at line 167 of file SVFIR.cpp.

168{
171 SVFVar* dstNode = getGNode(dst);
173 return nullptr;
174 else
175 {
176 std::vector<SVFVar*> opnds = {op1Node, op2Node};
177 CmpStmt* cmp = new CmpStmt(dstNode, opnds, predicate);
179 return cmp;
180 }
181}
CmpStmt * addCmpStmt(NodeID op1, NodeID op2, NodeID dst, u32_t predict)
Add Copy edge.
Definition SVFIR.cpp:167

◆ addConstantAggObjNode()

NodeID SVF::SVFIR::addConstantAggObjNode ( const NodeID  i,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Definition at line 706 of file SVFIR.h.

707 {
708 ConstAggObjVar* conObj = new ConstAggObjVar(i, ti, node);
709 return addBaseObjNode(conObj);
710 }
NodeID addBaseObjNode(BaseObjVar *node)
Definition SVFIR.h:511

◆ addConstantAggValNode()

NodeID SVF::SVFIR::addConstantAggValNode ( const NodeID  i,
const ICFGNode icfgNode,
const SVFType svfType 
)
inlineprivate

Definition at line 636 of file SVFIR.h.

637 {
638 SVFVar* node = new ConstAggValVar(i, icfgNode, svfType);
639 return addNode(node);
640 }
NodeID addNode(SVFVar *node)
Add a node into the graph.
Definition IRGraph.h:117

◆ addConstantDataObjNode()

NodeID SVF::SVFIR::addConstantDataObjNode ( const NodeID  i,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Definition at line 711 of file SVFIR.h.

712 {
713 ConstDataObjVar* conObj = new ConstDataObjVar(i, ti, node);
714 return addBaseObjNode(conObj);
715 }

◆ addConstantDataValNode()

NodeID SVF::SVFIR::addConstantDataValNode ( const NodeID  i,
const ICFGNode icfgNode,
const SVFType type 
)
inlineprivate

Definition at line 642 of file SVFIR.h.

643 {
644 SVFVar* node = new ConstDataValVar(i, icfgNode, type);
645 return addNode(node);
646 }

◆ addConstantFPObjNode()

NodeID SVF::SVFIR::addConstantFPObjNode ( NodeID  i,
ObjTypeInfo ti,
double  dval,
const ICFGNode node 
)
inlineprivate

Definition at line 680 of file SVFIR.h.

681 {
682 ConstFPObjVar* conObj = new ConstFPObjVar(i, dval, ti, node);
683 return addBaseObjNode(conObj);
684 }

◆ addConstantFPValNode()

NodeID SVF::SVFIR::addConstantFPValNode ( const NodeID  i,
double  dval,
const ICFGNode icfgNode,
const SVFType type 
)
inlineprivate

Definition at line 610 of file SVFIR.h.

612 {
613 SVFVar* node = new ConstFPValVar(i, dval, icfgNode, type);
614 return addNode(node);
615 }

◆ addConstantIntObjNode()

NodeID SVF::SVFIR::addConstantIntObjNode ( NodeID  i,
ObjTypeInfo ti,
const std::pair< s64_t, u64_t > &  intValue,
const ICFGNode node 
)
inlineprivate

Definition at line 687 of file SVFIR.h.

688 {
689 ConstIntObjVar* conObj =
690 new ConstIntObjVar(i, intValue.first, intValue.second, ti, node);
691 return addBaseObjNode(conObj);
692 }

◆ addConstantIntValNode()

NodeID SVF::SVFIR::addConstantIntValNode ( NodeID  i,
const std::pair< s64_t, u64_t > &  intValue,
const ICFGNode icfgNode,
const SVFType type 
)
inlineprivate

Definition at line 617 of file SVFIR.h.

619 {
620 SVFVar* node = new ConstIntValVar(i, intValue.first, intValue.second, icfgNode, type);
621 return addNode(node);
622 }

◆ addConstantNullPtrObjNode()

NodeID SVF::SVFIR::addConstantNullPtrObjNode ( const NodeID  i,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Definition at line 695 of file SVFIR.h.

696 {
697 ConstNullPtrObjVar* conObj = new ConstNullPtrObjVar(i, ti, node);
698 return addBaseObjNode(conObj);
699 }

◆ addConstantNullPtrValNode()

NodeID SVF::SVFIR::addConstantNullPtrValNode ( const NodeID  i,
const ICFGNode icfgNode,
const SVFType type 
)
inlineprivate

Definition at line 624 of file SVFIR.h.

625 {
626 SVFVar* node = new ConstNullPtrValVar(i, icfgNode, type);
627 return addNode(node);
628 }

◆ addConstantObjNode()

NodeID SVF::SVFIR::addConstantObjNode ( )
inlineprivate

Definition at line 768 of file SVFIR.h.

769 {
770 return addObjNode(new DummyObjVar(getConstantNode(), getObjTypeInfo(getConstantNode()), nullptr));
771 }
NodeID getConstantNode() const
Definition IRGraph.h:251

◆ addCopyStmt() [1/2]

void SVFIR::addCopyStmt ( CopyStmt edge)
private

Definition at line 99 of file SVFIR.cpp.

100{
102 addEdge(edge->getRHSVar(),edge->getLHSVar(), edge);
103}

◆ addCopyStmt() [2/2]

CopyStmt * SVFIR::addCopyStmt ( NodeID  src,
NodeID  dst,
CopyStmt::CopyKind  type 
)
private

Add Copy edge.

Add Copy edge

Definition at line 85 of file SVFIR.cpp.

86{
87 SVFVar* srcNode = getGNode(src);
88 SVFVar* dstNode = getGNode(dst);
90 return nullptr;
91 else
92 {
95 return copyPE;
96 }
97}
CopyStmt * addCopyStmt(NodeID src, NodeID dst, CopyStmt::CopyKind type)
Add Copy edge.
Definition SVFIR.cpp:85

◆ addDummyObjNode() [1/3]

NodeID SVF::SVFIR::addDummyObjNode ( const SVFType type)
inline

Definition at line 496 of file SVFIR.h.

497 {
498 return addDummyObjNode(NodeIDAllocator::get()->allocateObjectId(), type);
499 }
static NodeIDAllocator * get(void)
Return (singleton) allocator.
NodeID addDummyObjNode(const SVFType *type)
Definition SVFIR.h:496

◆ addDummyObjNode() [2/3]

NodeID SVFIR::addDummyObjNode ( DummyObjVar node)
protected

Definition at line 788 of file SVFIR.cpp.

789{
790 return addObjNode(node);
791}

◆ addDummyObjNode() [3/3]

NodeID SVF::SVFIR::addDummyObjNode ( NodeID  i,
const SVFType type 
)
inlineprivate

Definition at line 750 of file SVFIR.h.

751 {
752 if (idToObjTypeInfoMap().find(i) == idToObjTypeInfoMap().end())
753 {
754 ObjTypeInfo* ti = createObjTypeInfo(type);
756 return addDummyObjNode(new DummyObjVar(i, ti, nullptr));
757 }
758 else
759 {
760 return addDummyObjNode(new DummyObjVar(i, getObjTypeInfo(i), nullptr));
761 }
762 }
ObjTypeInfo * createObjTypeInfo(const SVFType *type)
Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy ...
Definition IRGraph.cpp:231
IDToTypeInfoMapTy & idToObjTypeInfoMap()
Get different kinds of syms maps.
Definition IRGraph.h:212

◆ addDummyValNode() [1/2]

NodeID SVF::SVFIR::addDummyValNode ( )
inline

Definition at line 492 of file SVFIR.h.

493 {
494 return addDummyValNode(NodeIDAllocator::get()->allocateValueId(), nullptr);
495 }

◆ addDummyValNode() [2/2]

NodeID SVF::SVFIR::addDummyValNode ( NodeID  i,
const ICFGNode node 
)
inlineprivate

Add a dummy value/object node according to node ID (llvm value is null)

Definition at line 746 of file SVFIR.h.

747 {
748 return addValNode(new DummyValVar(i, node));
749 }

◆ addFIObjNode()

NodeID SVF::SVFIR::addFIObjNode ( NodeID  i,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Add a field-insensitive node, this method can only invoked by getFIGepObjNode.

Definition at line 735 of file SVFIR.h.

736 {
737 BaseObjVar* baseObj = new BaseObjVar(i, ti, node);
738 return addBaseObjNode(baseObj);
739 }

◆ addFunArgs() [1/2]

void SVF::SVFIR::addFunArgs ( const FunObjVar fun,
const SVFVar arg 
)
inlineprivate

Get/set method for function/callsite arguments and returns.

Add function arguments

Definition at line 544 of file SVFIR.h.

545 {
546 FunEntryICFGNode* funEntryBlockNode = icfg->getFunEntryICFGNode(fun);
548 }
FunEntryICFGNode * getFunEntryICFGNode(const FunObjVar *fun)
Add a function entry node.
Definition ICFG.cpp:242
void addFunArgs(const FunObjVar *fun, const SVFVar *arg)
Get/set method for function/callsite arguments and returns.
Definition SVFIR.h:544

◆ addFunArgs() [2/2]

void SVF::SVFIR::addFunArgs ( FunEntryICFGNode funEntryBlockNode,
const FunObjVar fun,
const SVFVar arg 
)
inlineprivate

Definition at line 550 of file SVFIR.h.

551 {
552 funEntryBlockNode->addFormalParms(arg);
553 funArgsListMap[fun].push_back(arg);
554 }
FunToArgsListMap funArgsListMap
Map a function to a list of all its formal parameters.
Definition SVFIR.h:87

◆ addFunObjNode()

NodeID SVF::SVFIR::addFunObjNode ( NodeID  id,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Definition at line 673 of file SVFIR.h.

674 {
675 FunObjVar* funObj = new FunObjVar(id, ti, node);
676 return addBaseObjNode(funObj);
677 }

◆ addFunRet() [1/2]

void SVF::SVFIR::addFunRet ( const FunObjVar fun,
const SVFVar ret 
)
inlineprivate

Add function returns.

Definition at line 556 of file SVFIR.h.

557 {
558 FunExitICFGNode* funExitBlockNode = icfg->getFunExitICFGNode(fun);
559 addFunRet(funExitBlockNode, fun, ret);
560 }
FunExitICFGNode * getFunExitICFGNode(const FunObjVar *fun)
Add a function exit node.
Definition ICFG.cpp:249
void addFunRet(const FunObjVar *fun, const SVFVar *ret)
Add function returns.
Definition SVFIR.h:556

◆ addFunRet() [2/2]

void SVF::SVFIR::addFunRet ( FunExitICFGNode funExitBlockNode,
const FunObjVar fun,
const SVFVar ret 
)
inlineprivate

Definition at line 562 of file SVFIR.h.

563 {
564 funExitBlockNode->addFormalRet(ret);
565 funRetMap[fun] = ret;
566 }
FunToRetMap funRetMap
Map a function to its unique function return PAGNodes.
Definition SVFIR.h:90

◆ addFunValNode()

NodeID SVF::SVFIR::addFunValNode ( NodeID  i,
const ICFGNode icfgNode,
const FunObjVar funObjVar,
const SVFType type 
)
inlineprivate

Definition at line 597 of file SVFIR.h.

598 {
599 FunValVar* node = new FunValVar(i, icfgNode, funObjVar, type);
600 return addValNode(node);
601 }

◆ addGepObjNode() [1/2]

NodeID SVFIR::addGepObjNode ( const BaseObjVar baseObj,
const APOffset apOffset,
const NodeID  gepId 
)
private

Add a field obj node, this method can only invoked by getGepObjVar.

Add a field obj node, this method can only invoked by getGepObjVar

Definition at line 544 of file SVFIR.cpp.

545{
546 //assert(findPAGNode(i) == false && "this node should not be created before");
547 NodeID base = baseObj->getId();
548 assert(0==GepObjVarMap.count(std::make_pair(base, apOffset))
549 && "this node should not be created before");
550 //ABTest
551 GepObjVar *node = new GepObjVar(baseObj, gepId, apOffset);
552 return addGepObjNode(node, base, apOffset);
553}
NodeOffsetMap GepObjVarMap
Map a pair<base,off> to a gep obj node id.
Definition SVFIR.h:83
NodeID addGepObjNode(GepObjVar *gepObj, NodeID base, const APOffset &apOffset)
Definition SVFIR.cpp:532
u32_t NodeID
Definition GeneralType.h:56

◆ addGepObjNode() [2/2]

NodeID SVFIR::addGepObjNode ( GepObjVar gepObj,
NodeID  base,
const APOffset apOffset 
)
protected

Definition at line 532 of file SVFIR.cpp.

533{
534 assert(0==GepObjVarMap.count(std::make_pair(base, apOffset))
535 && "this node should not be created before");
536 GepObjVarMap[std::make_pair(base, apOffset)] = gepObj->getId();
537 memToFieldsMap[base].set(gepObj->getId());
538 return addObjNode(gepObj);
539}

◆ addGepStmt() [1/2]

void SVFIR::addGepStmt ( GepStmt edge)
private

Definition at line 437 of file SVFIR.cpp.

438{
439 SVFVar* baseNode = gepPE->getRHSVar();
440 SVFVar* dstNode = gepPE->getLHSVar();
443
444}

◆ addGepStmt() [2/2]

GepStmt * SVFIR::addGepStmt ( NodeID  src,
NodeID  dst,
const AccessPath ap,
bool  constGep 
)
private

Add Gep edge.

Add Offset(Gep) edge Find the base node id of src and connect base node to dst node Create gep offset: (offset + baseOff <nested struct gep size>)

Since the offset from base to src is variant, the new gep edge being created is also a Variant GepStmt edge.

Definition at line 404 of file SVFIR.cpp.

405{
406
407 SVFVar* node = getGNode(src);
408 if (!constGep || node->hasIncomingVariantGepEdge())
409 {
412 return addVariantGepStmt(src, dst, ap);
413 }
414 else
415 {
416 return addNormalGepStmt(src, dst, ap);
417 }
418}
GepStmt * addVariantGepStmt(NodeID src, NodeID dst, const AccessPath &ap)
Add Variant(Gep) edge.
Definition SVFIR.cpp:450
GepStmt * addNormalGepStmt(NodeID src, NodeID dst, const AccessPath &ap)
Add Offset(Gep) edge.
Definition SVFIR.cpp:423
bool hasIncomingVariantGepEdge() const
Check for incoming variable field GEP edges.

◆ addGepValNode()

NodeID SVFIR::addGepValNode ( NodeID  curInst,
const ValVar baseVar,
const AccessPath ap,
NodeID  i,
const SVFType type,
const ICFGNode icn 
)
private

Add a temp field value node, this method can only invoked by getGepValVar.

Add a temp field value node, this method can only invoked by getGepValVar due to constraint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.

Definition at line 471 of file SVFIR.cpp.

472{
473 NodeID base = baseVar->getId();
474 //assert(findPAGNode(i) == false && "this node should not be created before");
475 assert(0==GepValObjMap[curInst].count(std::make_pair(base, ap))
476 && "this node should not be created before");
477 GepValObjMap[curInst][std::make_pair(base, ap)] = i;
478 GepValVar *node = new GepValVar(baseVar, i, ap, type, icn);
480 return addValNode(node);
481}
int count
Definition cJSON.h:216
void setLLVMVarInstID(NodeID id)
Set the LLVM variable ID associated with this GepValVar.
GepValueVarMap GepValObjMap
Map a pair<base,off> to a gep value node id.
Definition SVFIR.h:81

◆ addGepValObjFromDB()

void SVF::SVFIR::addGepValObjFromDB ( NodeID  curInstID,
const GepValVar gepValvar 
)
inlineprotected

Definition at line 521 of file SVFIR.h.

522 {
523 GepValObjMap[curInstID][std::make_pair(gepValvar->getBaseNode()->getId(), gepValvar->getAccessPath())] = gepValvar->getId();
524 }

◆ addGlobalObjNode()

NodeID SVF::SVFIR::addGlobalObjNode ( const NodeID  i,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Definition at line 701 of file SVFIR.h.

702 {
703 GlobalObjVar* gObj = new GlobalObjVar(i, ti, node);
704 return addBaseObjNode(gObj);
705 }

◆ addGlobalPAGEdge()

void SVF::SVFIR::addGlobalPAGEdge ( const SVFStmt edge)
inlineprivate

Add global PAGEdges (not in a procedure)

Definition at line 794 of file SVFIR.h.

795 {
796 globSVFStmtSet.insert(edge);
797 }
SVFStmtSet globSVFStmtSet
Global PAGEdges without control flow information.
Definition SVFIR.h:85

◆ addGlobalValNode()

NodeID SVF::SVFIR::addGlobalValNode ( const NodeID  i,
const ICFGNode icfgNode,
const SVFType svfType 
)
inlineprivate

Definition at line 630 of file SVFIR.h.

631 {
632 SVFVar* node = new GlobalValVar(i, icfgNode, svfType);
633 return addNode(node);
634 }

◆ addHeapObjNode()

NodeID SVF::SVFIR::addHeapObjNode ( NodeID  i,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Creates and adds a heap object node to the SVFIR

Definition at line 658 of file SVFIR.h.

659 {
660 HeapObjVar *heapObj = new HeapObjVar(i, ti, node);
661 return addBaseObjNode(heapObj);
662 }

◆ addIndirectCallsites()

void SVF::SVFIR::addIndirectCallsites ( const CallICFGNode cs,
NodeID  funPtr 
)
inlineprivate

Add indirect callsites.

Definition at line 580 of file SVFIR.h.

581 {
582 bool added = indCallSiteToFunPtrMap.emplace(cs, funPtr).second;
583 (void) added;
584 funPtrToCallSitesMap[funPtr].insert(cs);
585 assert(added && "adding the same indirect callsite twice?");
586 }
CallSiteToFunPtrMap indCallSiteToFunPtrMap
Map an indirect callsite to its function pointer.
Definition SVFIR.h:91
FunPtrToCallSitesMap funPtrToCallSitesMap
Definition SVFIR.h:92

◆ addLoadStmt() [1/2]

void SVFIR::addLoadStmt ( LoadStmt edge)
private

Definition at line 277 of file SVFIR.cpp.

278{
280 addEdge(edge->getRHSVar(),edge->getLHSVar(), edge);
281}

◆ addLoadStmt() [2/2]

LoadStmt * SVFIR::addLoadStmt ( NodeID  src,
NodeID  dst 
)
private

Add Load edge.

Add Load edge

Definition at line 263 of file SVFIR.cpp.

264{
265 SVFVar* srcNode = getGNode(src);
266 SVFVar* dstNode = getGNode(dst);
268 return nullptr;
269 else
270 {
273 return loadPE;
274 }
275}
LoadStmt * addLoadStmt(NodeID src, NodeID dst)
Add Load edge.
Definition SVFIR.cpp:263

◆ addNormalGepStmt()

GepStmt * SVFIR::addNormalGepStmt ( NodeID  src,
NodeID  dst,
const AccessPath ap 
)
private

Add Offset(Gep) edge.

Add normal (Gep) edge

Definition at line 423 of file SVFIR.cpp.

424{
425 SVFVar* baseNode = getGNode(src);
426 SVFVar* dstNode = getGNode(dst);
428 return nullptr;
429 else
430 {
431 GepStmt* gepPE = new GepStmt(baseNode, dstNode, ap);
433 return gepPE;
434 }
435}
GepStmt * addGepStmt(NodeID src, NodeID dst, const AccessPath &ap, bool constGep)
Add Gep edge.
Definition SVFIR.cpp:404

◆ addObjNode() [1/2]

NodeID SVF::SVFIR::addObjNode ( NodeID  i,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Add a memory obj node.

Definition at line 650 of file SVFIR.h.

651 {
652 return addFIObjNode( i, ti, node);
653 }
NodeID addFIObjNode(NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
Add a field-insensitive node, this method can only invoked by getFIGepObjNode.
Definition SVFIR.h:735

◆ addObjNode() [2/2]

NodeID SVFIR::addObjNode ( ObjVar node)
private

Add a memory obj node.

Definition at line 779 of file SVFIR.cpp.

780{
781 assert(node && "node cannot be nullptr.");
782 assert(hasGNode(node->getId()) == false &&
783 "This NodeID clashes here. Please check NodeIDAllocator. Switch "
784 "Strategy::DBUG to SEQ or DENSE");
785 return addNode(node);
786}
bool hasGNode(NodeID id) const
Has a node.
NodeID getId() const
Get ID.
Definition SVFValue.h:160

◆ addPhiStmt() [1/2]

PhiStmt * SVFIR::addPhiStmt ( NodeID  res,
NodeID  opnd,
const ICFGNode pred 
)
private

Add phi node information.

Add Phi statement

return null if we already added this PhiStmt

Definition at line 108 of file SVFIR.cpp.

109{
111 SVFVar* resNode = getGNode(res);
112 PHINodeMap::iterator it = phiNodeMap.find(resNode);
113 if(it == phiNodeMap.end())
114 {
115 PhiStmt* phi = new PhiStmt(resNode, {opNode}, {pred});
117 return phi;
118 }
119 else
120 {
121 it->second->addOpVar(opNode,pred);
123 return nullptr;
124 }
125}
PHINodeMap phiNodeMap
A set of phi copy edges.
Definition SVFIR.h:86
PhiStmt * addPhiStmt(NodeID res, NodeID opnd, const ICFGNode *pred)
Add phi node information.
Definition SVFIR.cpp:108

◆ addPhiStmt() [2/2]

void SVFIR::addPhiStmt ( PhiStmt edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 127 of file SVFIR.cpp.

128{
129 SVFVar* opNode = src;
130 SVFVar* resNode = dst;
131
135
136}

◆ addRetNode() [1/2]

NodeID SVF::SVFIR::addRetNode ( const FunObjVar ,
SVFVar node 
)
inlineprivate

Add a unique return node for a procedure.

Definition at line 783 of file SVFIR.h.

784 {
785 return addNode(node);
786 }

◆ addRetNode() [2/2]

NodeID SVF::SVFIR::addRetNode ( NodeID  i,
const FunObjVar callGraphNode,
const SVFType type,
const ICFGNode icn 
)
inlineprivate

Add a unique return node for a procedure.

Definition at line 718 of file SVFIR.h.

719 {
720 SVFVar *node = new RetValPN(i, callGraphNode, type, icn);
721 return addRetNode(callGraphNode, node);
722 }
NodeID addRetNode(NodeID i, const FunObjVar *callGraphNode, const SVFType *type, const ICFGNode *icn)
Add a unique return node for a procedure.
Definition SVFIR.h:718

◆ addRetPE() [1/2]

RetPE * SVFIR::addRetPE ( NodeID  src,
NodeID  dst,
const CallICFGNode cs,
const FunExitICFGNode exit 
)
private

Add Return edge.

Add Return edge

Definition at line 333 of file SVFIR.cpp.

334{
335 SVFVar* srcNode = getGNode(src);
336 SVFVar* dstNode = getGNode(dst);
338 return nullptr;
339 else
340 {
341 RetPE* retPE = new RetPE(srcNode, dstNode, cs, exit);
342 addRetPE(retPE,srcNode,dstNode);
343 return retPE;
344 }
345}
RetPE * addRetPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunExitICFGNode *exit)
Add Return edge.
Definition SVFIR.cpp:333

◆ addRetPE() [2/2]

void SVFIR::addRetPE ( RetPE edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 347 of file SVFIR.cpp.

348{
350 addEdge(src, dst, edge);
351}

◆ addSelectStmt() [1/2]

SelectStmt * SVFIR::addSelectStmt ( NodeID  res,
NodeID  op1,
NodeID  op2,
NodeID  cond 
)
private

Add SelectStmt.

Add Phi statement

Definition at line 141 of file SVFIR.cpp.

142{
145 SVFVar* dstNode = getGNode(res);
146 SVFVar* condNode = getGNode(cond);
148 return nullptr;
149 else
150 {
151 std::vector<SVFVar*> opnds = {op1Node, op2Node};
154 return select;
155 }
156}
SelectStmt * addSelectStmt(NodeID res, NodeID op1, NodeID op2, NodeID cond)
Add SelectStmt.
Definition SVFIR.cpp:141

◆ addSelectStmt() [2/2]

void SVFIR::addSelectStmt ( SelectStmt edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 158 of file SVFIR.cpp.

159{
161 addEdge(src, dst, edge);
162}

◆ addStackObjNode()

NodeID SVF::SVFIR::addStackObjNode ( NodeID  i,
ObjTypeInfo ti,
const ICFGNode node 
)
inlineprivate

Creates and adds a stack object node to the SVFIR

Definition at line 667 of file SVFIR.h.

668 {
669 StackObjVar *stackObj = new StackObjVar(i, ti, node);
670 return addBaseObjNode(stackObj);
671 }

◆ addStoreStmt() [1/2]

StoreStmt * SVFIR::addStoreStmt ( NodeID  src,
NodeID  dst,
const ICFGNode curVal 
)
private

Add Store edge.

Add Store edge Note that two store instructions may share the same Store SVFStmt

Definition at line 287 of file SVFIR.cpp.

288{
289 SVFVar* srcNode = getGNode(src);
290 SVFVar* dstNode = getGNode(dst);
292 return nullptr;
293 else
294 {
295 StoreStmt* storePE = new StoreStmt(srcNode, dstNode, curVal);
297 return storePE;
298 }
299}
StoreStmt * addStoreStmt(NodeID src, NodeID dst, const ICFGNode *val)
Add Store edge.
Definition SVFIR.cpp:287

◆ addStoreStmt() [2/2]

void SVFIR::addStoreStmt ( StoreStmt edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 301 of file SVFIR.cpp.

302{
304 addEdge(src,dst, edge);
305}

◆ addThreadForkPE()

TDForkPE * SVFIR::addThreadForkPE ( NodeID  src,
NodeID  dst,
const CallICFGNode cs,
const FunEntryICFGNode entry 
)
private

Add Thread fork edge for parameter passing.

Add Thread fork edge for parameter passing from a spawner to its spawnees

Definition at line 367 of file SVFIR.cpp.

368{
369 SVFVar* srcNode = getGNode(src);
370 SVFVar* dstNode = getGNode(dst);
372 return nullptr;
373 else
374 {
375 TDForkPE* forkPE = new TDForkPE(srcNode, dstNode, cs, entry);
377 return forkPE;
378 }
379}

◆ addThreadJoinPE()

TDJoinPE * SVFIR::addThreadJoinPE ( NodeID  src,
NodeID  dst,
const CallICFGNode cs,
const FunExitICFGNode exit 
)
private

Add Thread join edge for parameter passing.

Add Thread fork edge for parameter passing from a spawnee back to its spawners

Definition at line 384 of file SVFIR.cpp.

385{
386 SVFVar* srcNode = getGNode(src);
387 SVFVar* dstNode = getGNode(dst);
389 return nullptr;
390 else
391 {
392 TDJoinPE* joinPE = new TDJoinPE(srcNode, dstNode, cs, exit);
394 return joinPE;
395 }
396}

◆ addToStmt2TypeMap()

void SVF::SVFIR::addToStmt2TypeMap ( SVFStmt edge)
inlineprivate

Map a SVFStatement type to a set of corresponding SVF statements.

this is a pointer-related SVFStmt if (1) both RHS and LHS are pointers or (2) this an int2ptr statment, i.e., LHS = int2ptr RHS

Definition at line 529 of file SVFIR.h.

530 {
531 bool added = KindToSVFStmtSetMap[edge->getEdgeKind()].insert(edge).second;
532 (void)added; // Suppress warning of unused variable under release build
533 assert(added && "duplicated edge, not added!!!");
535 if (edge->isPTAEdge() || (SVFUtil::isa<CopyStmt>(edge) && SVFUtil::cast<CopyStmt>(edge)->isInt2Ptr()))
536 {
538 KindToPTASVFStmtSetMap[edge->getEdgeKind()].insert(edge);
539 }
540 }
SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap
SVFIR edge map containing all PAGEdges.
Definition IRGraph.h:108
u32_t totalPTAPAGEdge
Definition IRGraph.h:112
SVFStmt::KindToSVFStmtMapTy KindToPTASVFStmtSetMap
SVFIR edge map containing only pointer-related edges, i.e., both LHS and RHS are of pointer type.
Definition IRGraph.h:109

◆ addToSVFStmtList()

void SVF::SVFIR::addToSVFStmtList ( ICFGNode inst,
SVFStmt edge 
)
inline

Add a SVFStmt into instruction map.

Definition at line 260 of file SVFIR.h.

261 {
262 edge->setICFGNode(inst);
263 icfgNode2SVFStmtsMap[inst].push_back(edge);
264 if (edge->isPTAEdge())
265 icfgNode2PTASVFStmtsMap[inst].push_back(edge);
266 }
ICFGNode2SVFStmtsMap icfgNode2SVFStmtsMap
Map an ICFGNode to its SVFStmts.
Definition SVFIR.h:79
ICFGNode2SVFStmtsMap icfgNode2PTASVFStmtsMap
Map an ICFGNode to its PointerAnalysis related SVFStmts.
Definition SVFIR.h:80

◆ addToTypeLocSetsMap()

void SVF::SVFIR::addToTypeLocSetsMap ( NodeID  argId,
SVFTypeLocSetsPair locSets 
)
inline

Add a base SVFType* and all its field location sets to an arg NodeId.

Definition at line 268 of file SVFIR.h.

269 {
271 }
TypeLocSetsMap typeLocSetsMap
Map an arg to its base SVFType* and all its field location sets.
Definition SVFIR.h:82

◆ addUnaryOPStmt() [1/2]

UnaryOPStmt * SVFIR::addUnaryOPStmt ( NodeID  src,
NodeID  dst,
u32_t  opcode 
)
private

Add Unary edge.

Add Unary edge

Definition at line 217 of file SVFIR.cpp.

218{
219 SVFVar* srcNode = getGNode(src);
220 SVFVar* dstNode = getGNode(dst);
222 return nullptr;
223 else
224 {
227 return unaryOP;
228 }
229}
UnaryOPStmt * addUnaryOPStmt(NodeID src, NodeID dst, u32_t opcode)
Add Unary edge.
Definition SVFIR.cpp:217

◆ addUnaryOPStmt() [2/2]

void SVFIR::addUnaryOPStmt ( UnaryOPStmt edge,
SVFVar src,
SVFVar dst 
)
private

Definition at line 231 of file SVFIR.cpp.

232{
234 addEdge(src, dst, edge);
235}

◆ addValNode() [1/2]

NodeID SVF::SVFIR::addValNode ( NodeID  i,
const SVFType type,
const ICFGNode icfgNode 
)
inlineprivate

add node into SVFIR

Add a value (pointer) node

Definition at line 591 of file SVFIR.h.

592 {
593 ValVar *node = new ValVar(i, type, icfgNode, ValVar::ValNode);
594 return addValNode(node);
595 }

◆ addValNode() [2/2]

NodeID SVFIR::addValNode ( ValVar node)
private

Add a value (pointer) node.

Definition at line 770 of file SVFIR.cpp.

771{
772 assert(node && "node cannot be nullptr.");
773 assert(hasGNode(node->getId()) == false &&
774 "This NodeID clashes here. Please check NodeIDAllocator. Switch "
775 "Strategy::DBUG to SEQ or DENSE");
776 return addNode(node);
777}

◆ addVarargNode() [1/2]

NodeID SVF::SVFIR::addVarargNode ( const FunObjVar ,
SVFVar node 
)
inlineprivate

Add a unique vararg node for a procedure.

Definition at line 788 of file SVFIR.h.

789 {
790 return addNode(node);
791 }

◆ addVarargNode() [2/2]

NodeID SVF::SVFIR::addVarargNode ( NodeID  i,
const FunObjVar val,
const SVFType type,
const ICFGNode n 
)
inlineprivate

Add a unique vararg node for a procedure.

Definition at line 724 of file SVFIR.h.

725 {
726 SVFVar *node = new VarArgValPN(i, val, type, n);
727 return addNode(node);
728 }
cJSON * n
Definition cJSON.cpp:2558

◆ addVariantGepStmt()

GepStmt * SVFIR::addVariantGepStmt ( NodeID  src,
NodeID  dst,
const AccessPath ap 
)
private

Add Variant(Gep) edge.

Add variant(Gep) edge Find the base node id of src and connect base node to dst node

Definition at line 450 of file SVFIR.cpp.

451{
452 SVFVar* baseNode = getGNode(src);
453 SVFVar* dstNode = getGNode(dst);
455 return nullptr;
456 else
457 {
458 GepStmt* gepPE = new GepStmt(baseNode, dstNode, ap, true);
461 return gepPE;
462 }
463}

◆ callsiteHasRet()

bool SVF::SVFIR::callsiteHasRet ( const RetICFGNode cs) const
inline

Definition at line 339 of file SVFIR.h.

340 {
341 return callSiteRetMap.find(cs) != callSiteRetMap.end();
342 }

◆ destroy()

void SVFIR::destroy ( )
private

Clean up memory.

Clean up memory

Definition at line 619 of file SVFIR.cpp.

620{
621 delete icfg;
622 icfg = nullptr;
623 delete chgraph;
624 chgraph = nullptr;
625 delete callGraph;
626 callGraph = nullptr;
627}
CallGraph * callGraph
all the callsites of a program
Definition SVFIR.h:99

◆ funHasRet()

bool SVF::SVFIR::funHasRet ( const FunObjVar func) const
inline

Definition at line 355 of file SVFIR.h.

356 {
357 return funRetMap.find(func) != funRetMap.end();
358 }

◆ getAllFieldsObjVars() [1/2]

NodeBS & SVFIR::getAllFieldsObjVars ( const BaseObjVar obj)

Get all fields of an object.

Get all fields object nodes of an object

Definition at line 558 of file SVFIR.cpp.

559{
560 NodeID base = obj->getId();
561 return memToFieldsMap[base];
562}

◆ getAllFieldsObjVars() [2/2]

NodeBS & SVFIR::getAllFieldsObjVars ( NodeID  id)

Get all fields object nodes of an object

Definition at line 567 of file SVFIR.cpp.

568{
569 const SVFVar* node = pag->getGNode(id);
570 assert(SVFUtil::isa<ObjVar>(node) && "need an object node");
572}
const BaseObjVar * getBaseObject(NodeID id) const
Definition SVFIR.h:424
NodeBS & getAllFieldsObjVars(const BaseObjVar *obj)
Get all fields of an object.
Definition SVFIR.cpp:558

◆ getAllValidPtrs()

OrderedNodeSet & SVF::SVFIR::getAllValidPtrs ( )
inline

Return valid pointers.

Definition at line 140 of file SVFIR.h.

141 {
142 return candidatePointers;
143 }
OrderedNodeSet candidatePointers
Definition SVFIR.h:95

◆ getBaseObject()

const BaseObjVar * SVF::SVFIR::getBaseObject ( NodeID  id) const
inline

Get memory object - Return memory object according to pag node id return whole allocated memory object if this node is a gep obj node return nullptr is this node is not a ObjVar type

Definition at line 424 of file SVFIR.h.

425 {
426 const SVFVar* node = getGNode(id);
427 if(const GepObjVar* gepObjVar = SVFUtil::dyn_cast<GepObjVar>(node))
428 return SVFUtil::dyn_cast<BaseObjVar>(
429 getGNode(gepObjVar->getBaseNode()));
430 else
431 return SVFUtil::dyn_cast<BaseObjVar>(node);
432 }

◆ getBaseObjVar()

NodeID SVF::SVFIR::getBaseObjVar ( NodeID  id) const
inline

Base and Offset methods for Value and Object node.

Get a base pointer node given a field pointer

Definition at line 480 of file SVFIR.h.

481 {
482 return getBaseObject(id)->getId();
483 }
NodeID getId() const
Get the memory object id.

◆ getBaseValVar()

const ValVar * SVF::SVFIR::getBaseValVar ( NodeID  id) const
inline

Definition at line 434 of file SVFIR.h.

435 {
436 const SVFVar* node = getGNode(id);
437 if(const GepValVar* gepVar = SVFUtil::dyn_cast<GepValVar>(node))
438 return gepVar->getBaseNode();
439 else
440 return SVFUtil::dyn_cast<ValVar>(node);
441 }

◆ getCallGraph()

const CallGraph * SVF::SVFIR::getCallGraph ( )
inline

Get CG.

Definition at line 180 of file SVFIR.h.

181 {
182 assert(callGraph && "empty CallGraph! Build SVF IR first!");
183 return callGraph;
184 }

◆ getCallSiteArgsList()

const SVFVarList & SVF::SVFIR::getCallSiteArgsList ( const CallICFGNode cs) const
inline

Get callsite argument list.

Definition at line 321 of file SVFIR.h.

322 {
323 CSToArgsListMap::const_iterator it = callSiteArgsListMap.find(cs);
324 assert(it != callSiteArgsListMap.end() && "this call site doesn't have arguments");
325 return it->second;
326 }

◆ getCallSiteArgsMap()

CSToArgsListMap & SVF::SVFIR::getCallSiteArgsMap ( )
inline

Get callsite argument list.

Definition at line 316 of file SVFIR.h.

317 {
318 return callSiteArgsListMap;
319 }

◆ getCallSiteRet()

const SVFVar * SVF::SVFIR::getCallSiteRet ( const RetICFGNode cs) const
inline

Get callsite return.

Definition at line 333 of file SVFIR.h.

334 {
335 CSToRetMap::const_iterator it = callSiteRetMap.find(cs);
336 assert(it != callSiteRetMap.end() && "this call site doesn't have return");
337 return it->second;
338 }

◆ getCallSiteRets()

CSToRetMap & SVF::SVFIR::getCallSiteRets ( )
inline

Get callsite return.

Definition at line 328 of file SVFIR.h.

329 {
330 return callSiteRetMap;
331 }

◆ getCallSiteSet()

const CallSiteSet & SVF::SVFIR::getCallSiteSet ( ) const
inline

Get all callsites.

Definition at line 283 of file SVFIR.h.

284 {
285 return callSiteSet;
286 }

◆ getCHG()

CommonCHGraph * SVF::SVFIR::getCHG ( )
inline

Definition at line 173 of file SVFIR.h.

174 {
175 assert(chgraph && "empty ICFG! Build SVF IR first!");
176 return chgraph;
177 }

◆ getFieldObjNodeNum()

u32_t SVF::SVFIR::getFieldObjNodeNum ( ) const
inline

Definition at line 367 of file SVFIR.h.

368 {
369 return GepObjVarMap.size();
370 }

◆ getFieldsAfterCollapse()

NodeBS SVFIR::getFieldsAfterCollapse ( NodeID  id)

Get all fields object nodes of an object If this object is collapsed into one field insensitive object Then only return this field insensitive object

Definition at line 579 of file SVFIR.cpp.

580{
581 const SVFVar* node = pag->getGNode(id);
582 assert(SVFUtil::isa<ObjVar>(node) && "need an object node");
583 const BaseObjVar* obj = getBaseObject(id);
584 if(obj->isFieldInsensitive())
585 {
586 NodeBS bs;
588 return bs;
589 }
590 else
591 return getAllFieldsObjVars(obj);
592}
NodeID getFIObjVar(const BaseObjVar *obj) const
Get a field-insensitive obj SVFIR node according to a mem obj.
Definition SVFIR.h:450
void set(unsigned Idx)

◆ getFieldValNodeNum()

u32_t SVF::SVFIR::getFieldValNodeNum ( ) const
inline

Node and edge statistics.

Definition at line 363 of file SVFIR.h.

364 {
365 return GepValObjMap.size();
366 }

◆ getFIObjVar() [1/2]

NodeID SVF::SVFIR::getFIObjVar ( const BaseObjVar obj) const
inline

Get a field-insensitive obj SVFIR node according to a mem obj.

Definition at line 450 of file SVFIR.h.

451 {
452 return obj->getId();
453 }

◆ getFIObjVar() [2/2]

NodeID SVF::SVFIR::getFIObjVar ( NodeID  id) const
inline

Definition at line 454 of file SVFIR.h.

455 {
456 return getBaseObjVar(id);
457 }
NodeID getBaseObjVar(NodeID id) const
Base and Offset methods for Value and Object node.
Definition SVFIR.h:480

◆ getFunArgsList()

const SVFVarList & SVF::SVFIR::getFunArgsList ( const FunObjVar func) const
inline

Get function arguments list.

Definition at line 304 of file SVFIR.h.

305 {
306 FunToArgsListMap::const_iterator it = funArgsListMap.find(func);
307 assert(it != funArgsListMap.end() && "this function doesn't have arguments");
308 return it->second;
309 }

◆ getFunArgsMap()

FunToArgsListMap & SVF::SVFIR::getFunArgsMap ( )
inline

Get function arguments list.

Definition at line 299 of file SVFIR.h.

300 {
301 return funArgsListMap;
302 }

◆ getFunObjVar()

const FunObjVar * SVFIR::getFunObjVar ( const std::string &  name)

Definition at line 47 of file SVFIR.cpp.

48{
49 for (const auto &item: *callGraph)
50 {
51 if (item.second->getName() == name)
52 {
53 return item.second->getFunction();
54 }
55 }
56 return nullptr;
57}
const char *const name
Definition cJSON.h:264
cJSON * item
Definition cJSON.h:222

◆ getFunPtr()

NodeID SVF::SVFIR::getFunPtr ( const CallICFGNode cs) const
inline

Definition at line 383 of file SVFIR.h.

384 {
385 CallSiteToFunPtrMap::const_iterator it = indCallSiteToFunPtrMap.find(cs);
386 assert(it!=indCallSiteToFunPtrMap.end() && "indirect callsite not have a function pointer?");
387 return it->second;
388 }

◆ getFunRet()

const SVFVar * SVF::SVFIR::getFunRet ( const FunObjVar func) const
inline

Get function return list.

Definition at line 349 of file SVFIR.h.

350 {
351 FunToRetMap::const_iterator it = funRetMap.find(func);
352 assert(it != funRetMap.end() && "this function doesn't have return");
353 return it->second;
354 }

◆ getFunRets()

FunToRetMap & SVF::SVFIR::getFunRets ( )
inline

Get function return list.

Definition at line 344 of file SVFIR.h.

345 {
346 return funRetMap;
347 }

◆ getGepObjNodeMap()

NodeOffsetMap & SVF::SVFIR::getGepObjNodeMap ( )
inline

Return GepObjVarMap.

Definition at line 135 of file SVFIR.h.

136 {
137 return GepObjVarMap;
138 }

◆ getGepObjVar() [1/2]

NodeID SVFIR::getGepObjVar ( const BaseObjVar baseObj,
const APOffset apOffset 
)

Get a field SVFIR Object node according to base mem obj and offset.

Get a field obj SVFIR node according to base mem obj and offset To support flexible field sensitive analysis with regard to MaxFieldOffset offset = offset % obj->getMaxFieldOffsetLimit() to create limited number of mem objects maximum number of field object creation is obj->getMaxFieldOffsetLimit()

if this obj is field-insensitive, just return the field-insensitive node.

Definition at line 508 of file SVFIR.cpp.

509{
510 NodeID base = baseObj->getId();
511
513 if (baseObj->isFieldInsensitive())
514 return getFIObjVar(baseObj);
515
516 APOffset newLS = pag->getModulusOffset(baseObj, apOffset);
517
518 // Base and first field are the same memory location.
519 if (Options::FirstFieldEqBase() && newLS == 0) return base;
520
521 NodeOffsetMap::iterator iter = GepObjVarMap.find(std::make_pair(base, newLS));
522 if (iter == GepObjVarMap.end())
523 {
526 }
527 else
528 return iter->second;
529
530}
NodeID allocateGepObjectId(NodeID base, u32_t offset, u32_t maxFieldLimit)
static const Option< bool > FirstFieldEqBase
Definition Options.h:100
static const Option< u32_t > MaxFieldLimit
Maximum number of field derivations for an object.
Definition Options.h:35
s64_t APOffset
Definition GeneralType.h:60

◆ getGepObjVar() [2/2]

NodeID SVFIR::getGepObjVar ( NodeID  id,
const APOffset apOffset 
)

Get a field obj SVFIR node according to a mem obj and a given offset.

Given an object node, find its field object node

Definition at line 486 of file SVFIR.cpp.

487{
488 SVFVar* node = pag->getGNode(id);
489 if (GepObjVar* gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
490 return getGepObjVar(gepNode->getBaseObj(), gepNode->getConstantFieldIdx() + apOffset);
491 else if (BaseObjVar* baseNode = SVFUtil::dyn_cast<BaseObjVar>(node))
492 return getGepObjVar(baseNode, apOffset);
493 else if (DummyObjVar* baseNode = SVFUtil::dyn_cast<DummyObjVar>(node))
494 return getGepObjVar(baseNode, apOffset);
495 else
496 {
497 assert(false && "new gep obj node kind?");
498 return id;
499 }
500}
NodeID getGepObjVar(const BaseObjVar *baseObj, const APOffset &ap)
Get a field SVFIR Object node according to base mem obj and offset.
Definition SVFIR.cpp:508

◆ getGepValVar()

NodeID SVFIR::getGepValVar ( NodeID  curInst,
NodeID  base,
const AccessPath ap 
) const

Due to constraint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.

It is used to create a dummy GepValVar during global initialization.

Definition at line 597 of file SVFIR.cpp.

598{
599 GepValueVarMap::const_iterator iter = GepValObjMap.find(curInst);
600 if(iter==GepValObjMap.end())
601 {
602 return UINT_MAX;
603 }
604 else
605 {
606 NodeAccessPathMap::const_iterator lit =
607 iter->second.find(std::make_pair(base, ap));
608 if (lit == iter->second.end())
609 return UINT_MAX;
610 else
611 return lit->second;
612 }
613}

◆ getGlobalSVFStmtSet()

SVFStmtSet & SVF::SVFIR::getGlobalSVFStmtSet ( )
inline

Get global PAGEdges (not in a procedure)

Definition at line 278 of file SVFIR.h.

279 {
280 return globSVFStmtSet;
281 }

◆ getICFG()

ICFG * SVF::SVFIR::getICFG ( ) const
inline

Definition at line 163 of file SVFIR.h.

164 {
165 assert(icfg->totalICFGNode>0 && "empty ICFG! Build SVF IR first!");
166 return icfg;
167 }
NodeID totalICFGNode
Definition ICFG.h:66

◆ getIndCallSites()

const CallSiteSet & SVF::SVFIR::getIndCallSites ( NodeID  funPtr) const
inline

Definition at line 389 of file SVFIR.h.

390 {
391 FunPtrToCallSitesMap::const_iterator it = funPtrToCallSitesMap.find(funPtr);
392 assert(it!=funPtrToCallSitesMap.end() && "function pointer not used at any indirect callsite?");
393 return it->second;
394 }

◆ getIndirectCallsites()

const CallSiteToFunPtrMap & SVF::SVFIR::getIndirectCallsites ( ) const
inline

Add/get indirect callsites.

Definition at line 379 of file SVFIR.h.

380 {
382 }

◆ getIntraPAGEdge() [1/2]

SVFStmt * SVF::SVFIR::getIntraPAGEdge ( NodeID  src,
NodeID  dst,
SVFStmt::PEDGEK  kind 
)
inline

Get an edge according to src, dst and kind.

Definition at line 406 of file SVFIR.h.

407 {
408 return getIntraPAGEdge(getGNode(src), getGNode(dst), kind);
409 }
SVFStmt * getIntraPAGEdge(NodeID src, NodeID dst, SVFStmt::PEDGEK kind)
Get an edge according to src, dst and kind.
Definition SVFIR.h:406

◆ getIntraPAGEdge() [2/2]

SVFStmt * SVF::SVFIR::getIntraPAGEdge ( SVFVar src,
SVFVar dst,
SVFStmt::PEDGEK  kind 
)
inline

Definition at line 410 of file SVFIR.h.

411 {
412 SVFStmt edge(src, dst, kind, false);
414 SVFStmt::SVFStmtSetTy::const_iterator it = edgeSet.find(&edge);
415 assert(it != edgeSet.end() && "can not find pag edge");
416 return (*it);
417 }
SVFStmt::SVFStmtSetTy & getSVFStmtSet(SVFStmt::PEDGEK kind)
Get/set methods to get SVFStmts based on their kinds and ICFGNodes.
Definition SVFIR.h:230
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy

◆ getMemToFieldsMap()

MemObjToFieldsMap & SVF::SVFIR::getMemToFieldsMap ( )
inline

Return memToFieldsMap.

Definition at line 130 of file SVFIR.h.

131 {
132 return memToFieldsMap;
133 }

◆ getModuleIdentifier()

const std::string & SVF::SVFIR::getModuleIdentifier ( ) const
inline

Definition at line 193 of file SVFIR.h.

194 {
195 if (pagReadFromTxt.empty())
196 {
197 assert(!moduleIdentifier.empty() &&
198 "No module found! Reading from a file other than LLVM-IR?");
199 return moduleIdentifier;
200 }
201 else
202 {
203 return pagReadFromTxt;
204 }
205 }
static std::string pagReadFromTxt
Definition SVFIR.h:102
std::string moduleIdentifier
Definition SVFIR.h:104

◆ getPAG()

static SVFIR * SVF::SVFIR::getPAG ( bool  buildFromFile = false)
inlinestatic

Singleton design here to make sure we only have one instance during any analysis.

Definition at line 116 of file SVFIR.h.

117 {
118 if (pag == nullptr)
119 {
120 pag = std::unique_ptr<SVFIR>(new SVFIR(buildFromFile));
121 }
122 return pag.get();
123 }
SVFIR(bool buildFromFile)
Constructor.
Definition SVFIR.cpp:42

◆ getPTASVFStmtList()

SVFStmtList & SVF::SVFIR::getPTASVFStmtList ( const ICFGNode inst)
inline

Given an instruction, get all its PTA PAGEdges.

Definition at line 255 of file SVFIR.h.

256 {
257 return icfgNode2PTASVFStmtsMap[inst];
258 }

◆ getPTASVFStmtSet()

SVFStmt::SVFStmtSetTy & SVF::SVFIR::getPTASVFStmtSet ( SVFStmt::PEDGEK  kind)
inline

Get PTA edges set according to its kind.

Definition at line 235 of file SVFIR.h.

236 {
237 return KindToPTASVFStmtSetMap[kind];
238 }

◆ getSVFStmtList()

SVFStmtList & SVF::SVFIR::getSVFStmtList ( const ICFGNode inst)
inline

Given an instruction, get all its PAGEdges.

Definition at line 250 of file SVFIR.h.

251 {
252 return icfgNode2SVFStmtsMap[inst];
253 }

◆ getSVFStmtSet()

SVFStmt::SVFStmtSetTy & SVF::SVFIR::getSVFStmtSet ( SVFStmt::PEDGEK  kind)
inline

Get/set methods to get SVFStmts based on their kinds and ICFGNodes.

Get edges set according to its kind

Definition at line 230 of file SVFIR.h.

231 {
232 return KindToSVFStmtSetMap[kind];
233 }

◆ getTypeLocSetsMap()

SVFTypeLocSetsPair & SVF::SVFIR::getTypeLocSetsMap ( NodeID  argId)
inline

Given an arg NodeId, get its base SVFType* and all its field location sets.

Definition at line 273 of file SVFIR.h.

274 {
275 return typeLocSetsMap[argId];
276 }

◆ handleBlackHole()

void SVFIR::handleBlackHole ( bool  b)
static

SVFIR build configurations.

Whether to handle blackhole edge

Definition at line 765 of file SVFIR.cpp.

766{
768}
const cJSON *const b
Definition cJSON.h:255
void setValue(T v)

◆ hasCallSiteArgsMap()

bool SVF::SVFIR::hasCallSiteArgsMap ( const CallICFGNode cs) const
inline

Callsite has argument list.

Definition at line 311 of file SVFIR.h.

312 {
313 return (callSiteArgsListMap.find(cs) != callSiteArgsListMap.end());
314 }

◆ hasFunArgsList()

bool SVF::SVFIR::hasFunArgsList ( const FunObjVar func) const
inline

Function has arguments list.

Definition at line 294 of file SVFIR.h.

295 {
296 return (funArgsListMap.find(func) != funArgsListMap.end());
297 }

◆ hasPTASVFStmtList()

bool SVF::SVFIR::hasPTASVFStmtList ( const ICFGNode inst) const
inline

Definition at line 244 of file SVFIR.h.

245 {
246 return icfgNode2PTASVFStmtsMap.find(inst) !=
248 }

◆ hasSVFStmtList()

bool SVF::SVFIR::hasSVFStmtList ( const ICFGNode inst) const
inline

Whether this instruction has SVFIR Edge.

Definition at line 240 of file SVFIR.h.

241 {
242 return icfgNode2SVFStmtsMap.find(inst) != icfgNode2SVFStmtsMap.end();
243 }

◆ initialiseCandidatePointers()

void SVFIR::initialiseCandidatePointers ( )

Initialize candidate pointers.

Definition at line 717 of file SVFIR.cpp.

718{
719 // collect candidate pointers for demand-driven analysis
720 for (iterator nIter = begin(); nIter != end(); ++nIter)
721 {
722 NodeID nodeId = nIter->first;
723 // do not compute points-to for isolated node
724 if (isValidPointer(nodeId) == false)
725 continue;
727 }
728}
IDToNodeMapTy::iterator iterator
Node Iterators.
bool isValidPointer(NodeID nodeId) const
Whether a node is a valid pointer.
Definition SVFIR.cpp:733

◆ isBlkObjOrConstantObj()

bool SVF::SVFIR::isBlkObjOrConstantObj ( NodeID  id) const
inline

Get black hole and constant id.

Definition at line 463 of file SVFIR.h.

464 {
465 return (isBlkObj(id) || isConstantObj(id));
466 }
static bool isBlkObj(NodeID id)
Definition IRGraph.h:165
bool isConstantObj(NodeID id) const
Definition SVFIR.h:468

◆ isConstantObj()

bool SVF::SVFIR::isConstantObj ( NodeID  id) const
inline

Definition at line 468 of file SVFIR.h.

469 {
470 const BaseObjVar* obj = getBaseObject(id);
471 assert(obj && "not an object node?");
472 return isConstantSym(id) ||
473 obj->isConstDataOrConstGlobal();
474 }
static bool isConstantSym(NodeID id)
Definition IRGraph.h:169

◆ isFunPtr()

bool SVF::SVFIR::isFunPtr ( NodeID  id) const
inline

Definition at line 399 of file SVFIR.h.

400 {
401 return (funPtrToCallSitesMap.find(id) != funPtrToCallSitesMap.end());
402 }

◆ isIndirectCallSites()

bool SVF::SVFIR::isIndirectCallSites ( const CallICFGNode cs) const
inline

Definition at line 395 of file SVFIR.h.

396 {
397 return (indCallSiteToFunPtrMap.find(cs) != indCallSiteToFunPtrMap.end());
398 }

◆ isPhiNode()

bool SVF::SVFIR::isPhiNode ( const SVFVar node) const
inline

Whether this SVFVar is a result operand a of phi node.

Definition at line 288 of file SVFIR.h.

289 {
290 return phiNodeMap.find(node) != phiNodeMap.end();
291 }

◆ isValidPointer()

bool SVFIR::isValidPointer ( NodeID  nodeId) const

Whether a node is a valid pointer.

Definition at line 733 of file SVFIR.cpp.

734{
735 SVFVar* node = pag->getGNode(nodeId);
736
737 if(node->isPointer())
738 if (const ValVar* pVar = pag->getBaseValVar(nodeId))
739 if (const ArgValVar* arg = SVFUtil::dyn_cast<ArgValVar>(pVar))
740 if (!(arg->getParent()->isDeclaration()))
741 return true;
742
743 if ((node->getInEdges().empty() && node->getOutEdges().empty()))
744 return false;
745 return node->isPointer();
746}
Class representing a function argument variable in the SVFIR.
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
virtual bool isPointer() const
Check if this variable represents a pointer.

◆ isValidTopLevelPtr()

bool SVFIR::isValidTopLevelPtr ( const SVFVar node)

Definition at line 748 of file SVFIR.cpp.

749{
750 if (SVFUtil::isa<ValVar>(node))
751 {
752 if (isValidPointer(node->getId()))
753 {
754 const ValVar* baseVar = pag->getBaseValVar(node->getId());
755 if(!SVFUtil::isa<DummyValVar, BlackHoleValVar>(baseVar))
757 }
758 }
759 return false;
760}
bool isArgOfUncalledFunction(const SVFVar *svfvar)
Definition SVFUtil.cpp:422

◆ pagFileName()

static std::string SVF::SVFIR::pagFileName ( )
inlinestatic

Definition at line 207 of file SVFIR.h.

208 {
209 return pagReadFromTxt;
210 }

◆ pagReadFromTXT()

static bool SVF::SVFIR::pagReadFromTXT ( )
inlinestatic

Definition at line 212 of file SVFIR.h.

213 {
214 return !pagReadFromTxt.empty();
215 }

◆ print()

void SVFIR::print ( )

Print SVFIR.

Print this SVFIR graph including its nodes and edges

Definition at line 632 of file SVFIR.cpp.

633{
634
635 outs() << "-------------------SVFIR------------------------------------\n";
636 SVFStmt::SVFStmtSetTy& addrs = pag->getSVFStmtSet(SVFStmt::Addr);
637 for (SVFStmt::SVFStmtSetTy::iterator iter = addrs.begin(), eiter =
638 addrs.end(); iter != eiter; ++iter)
639 {
640 outs() << (*iter)->getSrcID() << " -- Addr --> " << (*iter)->getDstID()
641 << "\n";
642 }
643
644 SVFStmt::SVFStmtSetTy& copys = pag->getSVFStmtSet(SVFStmt::Copy);
645 for (SVFStmt::SVFStmtSetTy::iterator iter = copys.begin(), eiter =
646 copys.end(); iter != eiter; ++iter)
647 {
648 outs() << (*iter)->getSrcID() << " -- Copy --> " << (*iter)->getDstID()
649 << "\n";
650 }
651
652 SVFStmt::SVFStmtSetTy& calls = pag->getSVFStmtSet(SVFStmt::Call);
653 for (SVFStmt::SVFStmtSetTy::iterator iter = calls.begin(), eiter =
654 calls.end(); iter != eiter; ++iter)
655 {
656 outs() << (*iter)->getSrcID() << " -- Call --> " << (*iter)->getDstID()
657 << "\n";
658 }
659
660 SVFStmt::SVFStmtSetTy& rets = pag->getSVFStmtSet(SVFStmt::Ret);
661 for (SVFStmt::SVFStmtSetTy::iterator iter = rets.begin(), eiter =
662 rets.end(); iter != eiter; ++iter)
663 {
664 outs() << (*iter)->getSrcID() << " -- Ret --> " << (*iter)->getDstID()
665 << "\n";
666 }
667
669 for (SVFStmt::SVFStmtSetTy::iterator iter = tdfks.begin(), eiter =
670 tdfks.end(); iter != eiter; ++iter)
671 {
672 outs() << (*iter)->getSrcID() << " -- ThreadFork --> "
673 << (*iter)->getDstID() << "\n";
674 }
675
677 for (SVFStmt::SVFStmtSetTy::iterator iter = tdjns.begin(), eiter =
678 tdjns.end(); iter != eiter; ++iter)
679 {
680 outs() << (*iter)->getSrcID() << " -- ThreadJoin --> "
681 << (*iter)->getDstID() << "\n";
682 }
683
684 SVFStmt::SVFStmtSetTy& ngeps = pag->getSVFStmtSet(SVFStmt::Gep);
685 for (SVFStmt::SVFStmtSetTy::iterator iter = ngeps.begin(), eiter =
686 ngeps.end(); iter != eiter; ++iter)
687 {
688 GepStmt* gep = SVFUtil::cast<GepStmt>(*iter);
689 if(gep->isVariantFieldGep())
690 outs() << (*iter)->getSrcID() << " -- VariantGep --> "
691 << (*iter)->getDstID() << "\n";
692 else
693 outs() << gep->getRHSVarID() << " -- Gep (" << gep->getConstantStructFldIdx()
694 << ") --> " << gep->getLHSVarID() << "\n";
695 }
696
697 SVFStmt::SVFStmtSetTy& loads = pag->getSVFStmtSet(SVFStmt::Load);
698 for (SVFStmt::SVFStmtSetTy::iterator iter = loads.begin(), eiter =
699 loads.end(); iter != eiter; ++iter)
700 {
701 outs() << (*iter)->getSrcID() << " -- Load --> " << (*iter)->getDstID()
702 << "\n";
703 }
704
706 for (SVFStmt::SVFStmtSetTy::iterator iter = stores.begin(), eiter =
707 stores.end(); iter != eiter; ++iter)
708 {
709 outs() << (*iter)->getSrcID() << " -- Store --> " << (*iter)->getDstID()
710 << "\n";
711 }
712 outs() << "----------------------------------------------------------\n";
713
714}
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52

◆ releaseSVFIR()

static void SVF::SVFIR::releaseSVFIR ( )
inlinestatic

Definition at line 124 of file SVFIR.h.

125 {
126 pag = nullptr;
127 }

◆ setCallGraph()

void SVF::SVFIR::setCallGraph ( CallGraph cg)
inline

Definition at line 186 of file SVFIR.h.

187 {
188 callGraph = cg;
189 }

◆ setCHG()

void SVF::SVFIR::setCHG ( CommonCHGraph c)
inline

Set/Get CHG.

Definition at line 169 of file SVFIR.h.

170 {
171 chgraph = c;
172 }

◆ setICFG()

void SVF::SVFIR::setICFG ( ICFG i)
inline

Set/Get ICFG.

Definition at line 159 of file SVFIR.h.

160 {
161 icfg = i;
162 }

◆ setModuleIdentifier()

void SVF::SVFIR::setModuleIdentifier ( const std::string &  moduleIdentifier)
inline

Definition at line 222 of file SVFIR.h.

223 {
225 }

◆ setPagFromTXT()

static void SVF::SVFIR::setPagFromTXT ( const std::string &  txt)
inlinestatic

Definition at line 217 of file SVFIR.h.

218 {
220 }

Friends And Related Symbol Documentation

◆ BVDataPTAImpl

Definition at line 48 of file SVFIR.h.

◆ ExternalPAG

friend class ExternalPAG
friend

Definition at line 45 of file SVFIR.h.

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 49 of file SVFIR.h.

◆ GraphDBSVFIRBuilder

friend class GraphDBSVFIRBuilder
friend

Definition at line 50 of file SVFIR.h.

◆ PAGBuilderFromFile

Definition at line 46 of file SVFIR.h.

◆ SVFIRBuilder

Definition at line 44 of file SVFIR.h.

◆ TypeBasedHeapCloning

friend class TypeBasedHeapCloning
friend

Definition at line 47 of file SVFIR.h.

Member Data Documentation

◆ callGraph

CallGraph* SVF::SVFIR::callGraph
private

all the callsites of a program

Definition at line 99 of file SVFIR.h.

◆ callSiteArgsListMap

CSToArgsListMap SVF::SVFIR::callSiteArgsListMap
private

Map a callsite to a list of all its actual parameters.

Definition at line 88 of file SVFIR.h.

◆ callSiteRetMap

CSToRetMap SVF::SVFIR::callSiteRetMap
private

Map a callsite to its callsite returns PAGNodes.

Definition at line 89 of file SVFIR.h.

◆ callSiteSet

CallSiteSet SVF::SVFIR::callSiteSet
private

Definition at line 98 of file SVFIR.h.

◆ candidatePointers

OrderedNodeSet SVF::SVFIR::candidatePointers
private

Valid pointers for pointer analysis resolution connected by SVFIR edges (constraints) this set of candidate pointers can change during pointer resolution (e.g. adding new object nodes)

Definition at line 95 of file SVFIR.h.

◆ chgraph

CommonCHGraph* SVF::SVFIR::chgraph
private

Definition at line 97 of file SVFIR.h.

◆ funArgsListMap

FunToArgsListMap SVF::SVFIR::funArgsListMap
private

Map a function to a list of all its formal parameters.

Definition at line 87 of file SVFIR.h.

◆ funPtrToCallSitesMap

FunPtrToCallSitesMap SVF::SVFIR::funPtrToCallSitesMap
private

Map a function pointer to the callsites where it is used

Definition at line 92 of file SVFIR.h.

◆ funRetMap

FunToRetMap SVF::SVFIR::funRetMap
private

Map a function to its unique function return PAGNodes.

Definition at line 90 of file SVFIR.h.

◆ GepObjVarMap

NodeOffsetMap SVF::SVFIR::GepObjVarMap
private

Map a pair<base,off> to a gep obj node id.

Definition at line 83 of file SVFIR.h.

◆ GepValObjMap

GepValueVarMap SVF::SVFIR::GepValObjMap
private

Map a pair<base,off> to a gep value node id.

Definition at line 81 of file SVFIR.h.

◆ globSVFStmtSet

SVFStmtSet SVF::SVFIR::globSVFStmtSet
private

Global PAGEdges without control flow information.

Definition at line 85 of file SVFIR.h.

◆ icfg

ICFG* SVF::SVFIR::icfg
private

Definition at line 96 of file SVFIR.h.

◆ icfgNode2PTASVFStmtsMap

ICFGNode2SVFStmtsMap SVF::SVFIR::icfgNode2PTASVFStmtsMap
private

Map an ICFGNode to its PointerAnalysis related SVFStmts.

Definition at line 80 of file SVFIR.h.

◆ icfgNode2SVFStmtsMap

ICFGNode2SVFStmtsMap SVF::SVFIR::icfgNode2SVFStmtsMap
private

Map an ICFGNode to its SVFStmts.

ValueNodes - This map indicates the Node that a particular SVFValue* is represented by. This contains entries for all pointers.

Definition at line 79 of file SVFIR.h.

◆ indCallSiteToFunPtrMap

CallSiteToFunPtrMap SVF::SVFIR::indCallSiteToFunPtrMap
private

Map an indirect callsite to its function pointer.

Definition at line 91 of file SVFIR.h.

◆ memToFieldsMap

MemObjToFieldsMap SVF::SVFIR::memToFieldsMap
private

Map a mem object id to all its fields.

Definition at line 84 of file SVFIR.h.

◆ moduleIdentifier

std::string SVF::SVFIR::moduleIdentifier
private

Definition at line 104 of file SVFIR.h.

◆ pag

std::unique_ptr< SVFIR > SVFIR::pag
staticprivate

Callgraph with direct calls only; no change allowed after init and use callgraph in PointerAnalysis for indirect calls)

Singleton pattern here to enable instance of SVFIR can only be created once.

Definition at line 101 of file SVFIR.h.

◆ pagReadFromTxt

std::string SVFIR::pagReadFromTxt = ""
staticprivate

Definition at line 102 of file SVFIR.h.

◆ phiNodeMap

PHINodeMap SVF::SVFIR::phiNodeMap
private

A set of phi copy edges.

Definition at line 86 of file SVFIR.h.

◆ typeLocSetsMap

TypeLocSetsMap SVF::SVFIR::typeLocSetsMap
private

Map an arg to its base SVFType* and all its field location sets.

Definition at line 82 of file SVFIR.h.


The documentation for this class was generated from the following files: