35using namespace SVFUtil;
281 return pag->addAddrStmt(
pag->getBlackHoleNode(), node);
392 &&
"this node should not be created before");
412 assert(
false &&
"new gep obj node kind?");
428 if (
obj->isFieldInsensitive())
455 &&
"this node should not be created before");
478 assert(mem->
getId() ==
id &&
"not same object id?");
501 assert(SVFUtil::isa<ObjVar>(node) &&
"need an object node");
502 const ObjVar*
obj = SVFUtil::cast<ObjVar>(node);
514 assert(SVFUtil::isa<ObjVar>(node) &&
"need an object node");
515 const MemObj* mem = SVFUtil::cast<ObjVar>(node)->getMemObj();
538 NodeAccessPathMap::const_iterator
lit =
539 iter->second.find(std::make_pair(base, ap));
569 outs() <<
"-------------------SVFIR------------------------------------\n";
571 for (SVFStmt::SVFStmtSetTy::iterator
iter = addrs.begin(),
eiter =
574 outs() << (*iter)->getSrcID() <<
" -- Addr --> " << (*iter)->getDstID()
579 for (SVFStmt::SVFStmtSetTy::iterator
iter =
copys.begin(),
eiter =
582 outs() << (*iter)->getSrcID() <<
" -- Copy --> " << (*iter)->getDstID()
587 for (SVFStmt::SVFStmtSetTy::iterator
iter =
calls.begin(),
eiter =
590 outs() << (*iter)->getSrcID() <<
" -- Call --> " << (*iter)->getDstID()
595 for (SVFStmt::SVFStmtSetTy::iterator
iter =
rets.begin(),
eiter =
598 outs() << (*iter)->getSrcID() <<
" -- Ret --> " << (*iter)->getDstID()
603 for (SVFStmt::SVFStmtSetTy::iterator
iter =
tdfks.begin(),
eiter =
606 outs() << (*iter)->getSrcID() <<
" -- ThreadFork --> "
607 << (*iter)->getDstID() <<
"\n";
611 for (SVFStmt::SVFStmtSetTy::iterator
iter =
tdjns.begin(),
eiter =
614 outs() << (*iter)->getSrcID() <<
" -- ThreadJoin --> "
615 << (*iter)->getDstID() <<
"\n";
619 for (SVFStmt::SVFStmtSetTy::iterator
iter =
ngeps.begin(),
eiter =
623 if(
gep->isVariantFieldGep())
624 outs() << (*iter)->getSrcID() <<
" -- VariantGep --> "
625 << (*iter)->getDstID() <<
"\n";
627 outs() <<
gep->getRHSVarID() <<
" -- Gep (" <<
gep->getConstantStructFldIdx()
628 <<
") --> " <<
gep->getLHSVarID() <<
"\n";
632 for (SVFStmt::SVFStmtSetTy::iterator
iter =
loads.begin(),
eiter =
635 outs() << (*iter)->getSrcID() <<
" -- Load --> " << (*iter)->getDstID()
643 outs() << (*iter)->getSrcID() <<
" -- Store --> " << (*iter)->getDstID()
646 outs() <<
"----------------------------------------------------------\n";
675 if (!(
arg->getParent()->isDeclaration()))
687 if (SVFUtil::isa<ValVar>(node))
692 if (SVFUtil::isa<RetPN, VarArgPN, FunValVar, HeapObjVar, StackObjVar>(node))
std::vector< std::pair< const ICFGNode *, s32_t > > SuccAndCondPairVec
const SVFFunction * getFunction() const
Get function of this call node.
iterator begin()
Iterators.
IDToNodeMapTy::iterator iterator
Node Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
SVFStmt * hasLabeledEdge(SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind, const ICFGNode *cs)
NodeID getValueNode(const SVFValue *V)
bool addEdge(SVFVar *src, SVFVar *dst, SVFStmt *edge)
Add an edge into the graph.
SVFStmt * hasNonlabeledEdge(SVFVar *src, SVFVar *dst, SVFStmt::PEDGEK kind)
const MemObj * getMemObj(const SVFValue *val) const
get MemObj according to LLVM value
SymID getId() const
Get the memory object id.
bool isFieldInsensitive() const
Return true if its field limit is 0.
const SVFValue * getValue() const
Get the reference value to this object.
static NodeIDAllocator * get(void)
Return (singleton) allocator.
NodeID allocateGepObjectId(NodeID base, u32_t offset, u32_t maxFieldLimit)
static const Option< bool > FirstFieldEqBase
static Option< bool > HandBlackHole
static const Option< u32_t > MaxFieldLimit
Maximum number of field derivations for an object.
NodeID getId() const
Get ID.
NodeID addFIObjNode(const MemObj *obj)
Add a field-insensitive node, this method can only invoked by getFIGepObjNode.
GepStmt * addVariantGepStmt(NodeID src, NodeID dst, const AccessPath &ap)
Add Variant(Gep) edge.
NodeOffsetMap GepObjVarMap
Map a pair<base,off> to a gep obj node id.
CopyStmt * addCopyStmt(NodeID src, NodeID dst, CopyStmt::CopyKind type)
Add Copy edge.
RetPE * addRetPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunExitICFGNode *exit)
Add Return edge.
GepStmt * addGepStmt(NodeID src, NodeID dst, const AccessPath &ap, bool constGep)
Add Gep edge.
NodeID addObjNode(const SVFValue *val, NodeID i)
Add a memory obj node.
static void handleBlackHole(bool b)
SVFIR build configurations.
NodeID getFIObjVar(const MemObj *obj) const
Get a field-insensitive obj SVFIR node according to a mem obj.
void addToStmt2TypeMap(SVFStmt *edge)
Map a SVFStatement type to a set of corresponding SVF statements.
SVFStmt * addBlackHoleAddrStmt(NodeID node)
Set a pointer points-to black hole (e.g. int2ptr)
LoadStmt * addLoadStmt(NodeID src, NodeID dst)
Add Load edge.
GepStmt * addNormalGepStmt(NodeID src, NodeID dst, const AccessPath &ap)
Add Offset(Gep) edge.
MemObjToFieldsMap memToFieldsMap
Map a mem object id to all its fields.
PHINodeMap phiNodeMap
A set of phi copy edges.
NodeBS getFieldsAfterCollapse(NodeID id)
NodeID addGepValNode(const SVFValue *curInst, const SVFValue *val, const AccessPath &ap, NodeID i, const SVFType *type)
Add a temp field value node, this method can only invoked by getGepValVar.
CallPE * addCallPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunEntryICFGNode *entry)
Add Call edge.
bool isValidTopLevelPtr(const SVFVar *node)
NodeID addValNode(const SVFValue *val, NodeID i, const ICFGNode *icfgNode)
add node into SVFIR
TDJoinPE * addThreadJoinPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunExitICFGNode *exit)
Add Thread join edge for parameter passing.
CallGraph * callGraph
all the callsites of a program
void destroy()
Clean up memory.
NodeID addGepObjNode(const MemObj *obj, const APOffset &apOffset, const NodeID gepId)
Add a field obj node, this method can only invoked by getGepObjVar.
NodeBS & getAllFieldsObjVars(const MemObj *obj)
Get all fields of an object.
CmpStmt * addCmpStmt(NodeID op1, NodeID op2, NodeID dst, u32_t predict)
Add Copy edge.
AddrStmt * addAddrStmt(NodeID src, NodeID dst)
Add an edge into SVFIR.
UnaryOPStmt * addUnaryOPStmt(NodeID src, NodeID dst, u32_t opcode)
Add Unary edge.
TDForkPE * addThreadForkPE(NodeID src, NodeID dst, const CallICFGNode *cs, const FunEntryICFGNode *entry)
Add Thread fork edge for parameter passing.
BinaryOPStmt * addBinaryOPStmt(NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
Add Copy edge.
static std::unique_ptr< SVFIR > pag
call graph
StoreStmt * addStoreStmt(NodeID src, NodeID dst, const ICFGNode *val)
Add Store edge.
PhiStmt * addPhiStmt(NodeID res, NodeID opnd, const ICFGNode *pred)
Add phi node information.
OrderedNodeSet candidatePointers
SVFIR(bool buildFromFile)
Constructor.
SelectStmt * addSelectStmt(NodeID res, NodeID op1, NodeID op2, NodeID cond)
Add SelectStmt.
NodeID getGepValVar(const SVFValue *curInst, NodeID base, const AccessPath &ap) const
Due to constraint expression, curInst is used to distinguish different instructions (e....
GepValueVarMap GepValObjMap
Map a pair<base,off> to a gep value node id.
NodeID addFunObjNode(const CallGraphNode *callGraphNode, NodeID id)
bool isValidPointer(NodeID nodeId) const
Whether a node is a valid pointer.
NodeID getGepObjVar(const MemObj *obj, const APOffset &ap)
Get a field SVFIR Object node according to base mem obj and offset.
BranchStmt * addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec &succs)
Add BranchStmt.
void initialiseCandidatePointers()
Initialize candidate pointers.
static void releaseSVFModule()
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
const SVFValue * getValue() const
Get/has methods of the components.
virtual bool isPointer() const
Whether it is a pointer.
bool hasIncomingVariantGepEdge() const
Has incoming VariantGepEdges.
bool isArgOfUncalledFunction(const SVFValue *svfval)
Return true if this argument belongs to an uncalled function.
std::ostream & outs()
Overwrite llvm::outs()
llvm::IRBuilder IRBuilder