42 using namespace SVFUtil;
52 std::stringstream rawstr(str);
53 rawstr <<
"MRSVFGNode ID: " << getId();
60 std::stringstream rawstr(str);
61 rawstr <<
"FormalINSVFGNode ID: " << getId() <<
" {fun: " << getFun()->getName() <<
"}";
62 rawstr << getMRVer()->getMR()->getMRID() <<
"V_" << getMRVer()->getSSAVersion() <<
63 " = ENCHI(MR_" << getMRVer()->getMR()->getMRID() <<
"V_" << getMRVer()->getSSAVersion() <<
")\n";
64 rawstr << getMRVer()->getMR()->dumpStr() <<
"\n";
71 std::stringstream rawstr(str);
72 rawstr <<
"FormalOUTSVFGNode ID: " << getId() <<
" {fun: " << getFun()->getName() <<
"}";
73 rawstr <<
"RETMU(" << getMRVer()->getMR()->getMRID() <<
"V_" << getMRVer()->getSSAVersion() <<
")\n";
74 rawstr << getMRVer()->getMR()->dumpStr() <<
"\n";
81 std::stringstream rawstr(str);
82 rawstr <<
"ActualINSVFGNode ID: " << getId() <<
" at callsite: " << (getCallSite())->valueOnlyToString() <<
" {fun: " << getFun()->getName() <<
"}";
83 rawstr <<
"CSMU(" << getMRVer()->getMR()->getMRID() <<
"V_" << getMRVer()->getSSAVersion() <<
")\n";
84 rawstr << getMRVer()->getMR()->dumpStr() <<
"\n";
85 rawstr <<
"CS[" << getCallSite()->getSourceLoc() <<
"]";
92 std::stringstream rawstr(str);
93 rawstr <<
"ActualOUTSVFGNode ID: " << getId() <<
" at callsite: " << (getCallSite())->valueOnlyToString() <<
" {fun: " << getFun()->getName() <<
"}";
94 rawstr << getMRVer()->getMR()->getMRID() <<
"V_" << getMRVer()->getSSAVersion() <<
95 " = CSCHI(MR_" << getMRVer()->getMR()->getMRID() <<
"V_" << getMRVer()->getSSAVersion() <<
")\n";
96 rawstr << getMRVer()->getMR()->dumpStr() <<
"\n";
97 rawstr <<
"CS[" << getCallSite()->getSourceLoc() <<
"]" ;
104 std::stringstream rawstr(str);
105 rawstr <<
"MSSAPHISVFGNode ID: " << getId() <<
" {fun: " << getFun()->getName() <<
"}";
106 rawstr <<
"MR_" << getResVer()->getMR()->getMRID()
107 <<
"V_" << getResVer()->getSSAVersion() <<
" = PHI(";
108 for (MemSSA::PHI::OPVers::const_iterator it = opVerBegin(), eit = opVerEnd();
110 rawstr <<
"MR_" << it->second->getMR()->getMRID() <<
"V_" << it->second->getSSAVersion() <<
", ";
113 rawstr << getResVer()->getMR()->dumpStr();
115 dyn_cast<IntraICFGNode>(getICFGNode()->getBB()->back()))
117 rawstr << intraNode->getSourceLoc();
125 std::stringstream rawstr(str);
126 rawstr <<
"IntraMSSAPHISVFGNode ID: " << getId() <<
" {fun: " << getFun()->getName() <<
"}";
141 std::stringstream rawstr(str);
143 rawstr <<
"FormalINPHISVFGNode ID: " << getId() <<
" {fun: " << getFun()->getName() <<
"}";
145 rawstr <<
"ActualOUTPHISVFGNode ID: " << getId() <<
" at callsite: " << (getCallSite())->valueOnlyToString() <<
" {fun: " << getFun()->getName() <<
"}";
153 std::stringstream rawstr(str);
154 rawstr <<
"IndirectSVFGEdge: " << getDstID() <<
"<--" << getSrcID() <<
"\n";
161 std::stringstream rawstr(str);
162 rawstr <<
"IntraIndSVFGEdge: " << getDstID() <<
"<--" << getSrcID() <<
"\n";
169 std::stringstream rawstr(str);
170 rawstr <<
"CallIndSVFGEdge CallSite ID: " << getCallSiteId() <<
" ";
171 rawstr << getDstID() <<
"<--" << getSrcID() <<
"\n";
178 std::stringstream rawstr(str);
179 rawstr <<
"RetIndSVFGEdge CallSite ID: " << getCallSiteId() <<
" ";
180 rawstr << getDstID() <<
"<--" << getSrcID() <<
"\n";
188 std::stringstream rawstr(str);
189 rawstr <<
"ThreadMHPIndSVFGEdge: " << getDstID() <<
"<--" << getSrcID() <<
"\n";
204 SVFG::SVFG(std::unique_ptr<MemSSA> mssa,
VFGK k):
VFG(mssa->getPTA()->getCallGraph(),k),mssa(std::
move(mssa)), pta(this->mssa->getPTA())
260 for (SVFStmt::SVFStmtSetTy::iterator iter = stores.begin(), eiter =
261 stores.end(); iter != eiter; ++iter)
263 StoreStmt* store = SVFUtil::cast<StoreStmt>(*iter);
265 for(CHISet::iterator pi =
mssa->getCHISet(store).begin(), epi =
mssa->getCHISet(store).end(); pi!=epi; ++pi)
266 setDef((*pi)->getResVer(),sNode);
272 for(MemSSA::BBToPhiSetMap::iterator it =
mssa->getBBToPhiSetMap().begin(),
273 eit =
mssa->getBBToPhiSetMap().end(); it!=eit; ++it)
275 for(PHISet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
283 for(MemSSA::FunToEntryChiSetMap::iterator it =
mssa->getFunToEntryChiSetMap().begin(),
284 eit =
mssa->getFunToEntryChiSetMap().end(); it!=eit; ++it)
286 for(CHISet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
293 for(MemSSA::FunToReturnMuSetMap::iterator it =
mssa->getFunToRetMuSetMap().begin(),
294 eit =
mssa->getFunToRetMuSetMap().end(); it!=eit; ++it)
296 for(MUSet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
303 for(MemSSA::CallSiteToMUSetMap::iterator it =
mssa->getCallSiteToMuSetMap().begin(),
304 eit =
mssa->getCallSiteToMuSetMap().end();
307 for(MUSet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
314 for(MemSSA::CallSiteToCHISetMap::iterator it =
mssa->getCallSiteToChiSetMap().begin(),
315 eit =
mssa->getCallSiteToChiSetMap().end();
318 for(CHISet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
335 NodeID nodeId = it->first;
337 if(
const LoadSVFGNode* loadNode = SVFUtil::dyn_cast<LoadSVFGNode>(node))
339 MUSet& muSet =
mssa->getMUSet(SVFUtil::cast<LoadStmt>(loadNode->getPAGEdge()));
340 for(MUSet::iterator it = muSet.begin(), eit = muSet.end(); it!=eit; ++it)
342 if(
LOADMU* mu = SVFUtil::dyn_cast<LOADMU>(*it))
349 else if(
const StoreSVFGNode* storeNode = SVFUtil::dyn_cast<StoreSVFGNode>(node))
351 CHISet& chiSet =
mssa->getCHISet(SVFUtil::cast<StoreStmt>(storeNode->getPAGEdge()));
352 for(CHISet::iterator it = chiSet.begin(), eit = chiSet.end(); it!=eit; ++it)
354 if(
STORECHI* chi = SVFUtil::dyn_cast<STORECHI>(*it))
361 else if(
const FormalINSVFGNode* formalIn = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
364 mssa->getPTA()->getCallGraph()->getDirCallSitesInvokingCallee(formalIn->getFun(),callInstSet);
365 for(PTACallGraphEdge::CallInstSet::iterator it = callInstSet.begin(), eit = callInstSet.end(); it!=eit; ++it)
378 else if(
const FormalOUTSVFGNode* formalOut = SVFUtil::dyn_cast<FormalOUTSVFGNode>(node))
382 mssa->getPTA()->getCallGraph()->getDirCallSitesInvokingCallee(formalOut->getFun(),callInstSet);
383 for(PTACallGraphEdge::CallInstSet::iterator it = callInstSet.begin(), eit = callInstSet.end(); it!=eit; ++it)
386 if(!
mssa->hasCHI(cs))
398 else if(
const ActualINSVFGNode* actualIn = SVFUtil::dyn_cast<ActualINSVFGNode>(node))
400 const MRVer* ver = actualIn->getMRVer();
404 else if(SVFUtil::isa<ActualOUTSVFGNode>(node))
408 else if(
const MSSAPHISVFGNode* phiNode = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
410 for (MemSSA::PHI::OPVers::const_iterator it = phiNode->opVerBegin(), eit = phiNode->opVerEnd();
413 const MRVer* op = it->second;
432 if (formalIns.
empty())
436 storeIt != storeEit; ++storeIt)
438 if (
const StoreSVFGNode* store = SVFUtil::dyn_cast<StoreSVFGNode>(*storeIt))
441 const NodeBS& storePts =
mssa->getPTA()->getPts(store->getPAGDstNodeID()).toNodeBS();
444 formalIns.
end(); fiIt != fiEit; ++fiIt)
446 NodeID formalInID = *fiIt;
449 formalInPts &= storePts;
450 if (formalInPts.
empty())
470 assert(SVFUtil::isa<IndirectSVFGEdge>(edge) &&
"this should be a indirect value flow edge!");
471 return (SVFUtil::cast<IndirectSVFGEdge>(edge)->addPointsTo(cpts) ? edge :
nullptr);
477 return (
addSVFGEdge(indirectEdge) ? indirectEdge :
nullptr);
491 assert(SVFUtil::isa<IndirectSVFGEdge>(edge) &&
"this should be a indirect value flow edge!");
492 return (SVFUtil::cast<IndirectSVFGEdge>(edge)->addPointsTo(cpts) ? edge :
nullptr);
498 return (
addSVFGEdge(indirectEdge) ? indirectEdge :
nullptr);
511 assert(SVFUtil::isa<CallIndSVFGEdge>(edge) &&
"this should be a indirect value flow edge!");
512 return (SVFUtil::cast<CallIndSVFGEdge>(edge)->addPointsTo(cpts) ? edge :
nullptr);
518 return (
addSVFGEdge(callEdge) ? callEdge :
nullptr);
531 assert(SVFUtil::isa<RetIndSVFGEdge>(edge) &&
"this should be a indirect value flow edge!");
532 return (SVFUtil::cast<RetIndSVFGEdge>(edge)->addPointsTo(cpts) ? edge :
nullptr);
594 SVFIR::SVFVarList::const_iterator csArgIt = csArgList.begin(), csArgEit = csArgList.end();
595 SVFIR::SVFVarList::const_iterator funArgIt = funArgList.begin(), funArgEit = funArgList.end();
596 for (; funArgIt != funArgEit && csArgIt != csArgEit; funArgIt++, csArgIt++)
598 const PAGNode *cs_arg = *csArgIt;
599 const PAGNode *fun_arg = *funArgIt;
603 assert(funArgIt == funArgEit &&
"function has more arguments than call site");
610 for (; csArgIt != csArgEit; csArgIt++)
612 const PAGNode *cs_arg = *csArgIt;
634 ai_eit = actualInNodes.
end(); ai_it!=ai_eit; ++ai_it)
646 ao_eit = actualOutNodes.
end(); ao_it!=ao_eit; ++ao_it)
670 ai_eit = actualInNodes.
end(); ai_it!=ai_eit; ++ai_it)
674 fi_eit = formalInNodes.
end(); fi_it!=fi_eit; ++fi_it)
689 fo_eit = formalOutNodes.
end(); fo_it!=fo_eit; ++fo_it)
693 ao_eit = actualOutNodes.
end(); ao_it!=ao_eit; ++ao_it)
712 else if(
const InterPHISVFGNode* phi = SVFUtil::dyn_cast<InterPHISVFGNode>(node))
714 if(phi->isFormalParmPHI())
715 return phi->getFun();
717 else if(
const FormalINSVFGNode* fi = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
723 if(mphi->isFormalINPHI())
724 return mphi->getFun();
736 return ar->getCallSite();
738 else if(
const InterPHISVFGNode* phi = SVFUtil::dyn_cast<InterPHISVFGNode>(node))
740 if(phi->isActualRetPHI())
741 return phi->getCallSite();
743 else if(
const ActualOUTSVFGNode* ao = SVFUtil::dyn_cast<ActualOUTSVFGNode>(node))
745 return ao->getCallSite();
749 if(mphi->isActualOUTPHI())
750 return mphi->getCallSite();
795 return getSimpleNodeLabel(node, graph);
797 return getCompleteNodeLabel(node, graph);
804 std::stringstream rawstr(str);
805 if(
StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
807 rawstr << stmtNode->toString();
809 else if(
PHISVFGNode* tphi = SVFUtil::dyn_cast<PHISVFGNode>(node))
811 rawstr << tphi->toString();
815 rawstr << fp->toString();
819 rawstr << ap->toString();
823 rawstr << ar->toString();
827 rawstr << fr->toString();
831 rawstr << fi->toString();
835 rawstr << fo->toString();
839 rawstr << ai->toString();
843 rawstr << ao->toString();
845 else if(
MSSAPHISVFGNode* mphi = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
847 rawstr << mphi->toString();
849 else if(SVFUtil::isa<NullPtrSVFGNode>(node))
853 else if(
BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
855 rawstr << bop->toString();
857 else if(
UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
859 rawstr << uop->toString();
861 else if(
CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
863 rawstr << cmp->toString();
866 assert(
false &&
"what else kinds of nodes do we have??");
876 std::stringstream rawstr(str);
877 if(
StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
879 rawstr << stmtNode->toString();
881 else if(
BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
883 rawstr << bop->toString();
885 else if(
UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
887 rawstr << uop->toString();
889 else if(
CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
891 rawstr << cmp->toString();
893 else if(
MSSAPHISVFGNode* mphi = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
895 rawstr << mphi->toString();
897 else if(
PHISVFGNode* tphi = SVFUtil::dyn_cast<PHISVFGNode>(node))
899 rawstr << tphi->toString();
903 rawstr << fi->toString();
907 rawstr << fo->toString();
911 rawstr << fp->toString();
915 rawstr << ai->toString();
919 rawstr << ao->toString();
923 rawstr << ap->toString();
925 else if(
NullPtrSVFGNode* nptr = SVFUtil::dyn_cast<NullPtrSVFGNode>(node))
927 rawstr << nptr->toString();
931 rawstr << ar->toString();
935 rawstr << fr->toString();
937 else if (
BranchVFGNode* br = SVFUtil::dyn_cast<BranchVFGNode>(node))
939 rawstr << br->toString();
942 assert(
false &&
"what else kinds of nodes do we have??");
950 std::stringstream rawstr(str);
952 if(
StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
954 const PAGEdge* edge = stmtNode->getPAGEdge();
955 if (SVFUtil::isa<AddrStmt>(edge))
957 rawstr <<
"color=green";
959 else if (SVFUtil::isa<CopyStmt>(edge))
961 rawstr <<
"color=black";
963 else if (SVFUtil::isa<RetPE>(edge))
965 rawstr <<
"color=black,style=dotted";
967 else if (SVFUtil::isa<GepStmt>(edge))
969 rawstr <<
"color=purple";
971 else if (SVFUtil::isa<StoreStmt>(edge))
973 rawstr <<
"color=blue";
975 else if (SVFUtil::isa<LoadStmt>(edge))
977 rawstr <<
"color=red";
981 assert(0 &&
"No such kind edge!!");
985 else if(SVFUtil::isa<MSSAPHISVFGNode>(node))
987 rawstr <<
"color=black";
989 else if(SVFUtil::isa<PHISVFGNode>(node))
991 rawstr <<
"color=black";
993 else if(SVFUtil::isa<NullPtrSVFGNode>(node))
995 rawstr <<
"color=grey";
997 else if(SVFUtil::isa<FormalINSVFGNode>(node))
999 rawstr <<
"color=yellow,penwidth=2";
1001 else if(SVFUtil::isa<FormalOUTSVFGNode>(node))
1003 rawstr <<
"color=yellow,penwidth=2";
1005 else if(SVFUtil::isa<FormalParmSVFGNode>(node))
1007 rawstr <<
"color=yellow,penwidth=2";
1009 else if(SVFUtil::isa<ActualINSVFGNode>(node))
1011 rawstr <<
"color=yellow,penwidth=2";
1013 else if(SVFUtil::isa<ActualOUTSVFGNode>(node))
1015 rawstr <<
"color=yellow,penwidth=2";
1017 else if(SVFUtil::isa<ActualParmSVFGNode>(node))
1019 rawstr <<
"color=yellow,penwidth=2";
1021 else if (SVFUtil::isa<ActualRetSVFGNode>(node))
1023 rawstr <<
"color=yellow,penwidth=2";
1025 else if (SVFUtil::isa<FormalRetSVFGNode>(node))
1027 rawstr <<
"color=yellow,penwidth=2";
1029 else if (SVFUtil::isa<BinaryOPVFGNode>(node))
1031 rawstr <<
"color=black,penwidth=2";
1033 else if (SVFUtil::isa<CmpVFGNode>(node))
1035 rawstr <<
"color=black,penwidth=2";
1037 else if (SVFUtil::isa<UnaryOPVFGNode>(node))
1039 rawstr <<
"color=black,penwidth=2";
1041 else if (SVFUtil::isa<BranchVFGNode>(node))
1043 rawstr <<
"color=gold,penwidth=2";
1046 assert(
false &&
"no such kind of node!!");
1051 rawstr <<
",style=filled, fillcolor=red";
1055 rawstr <<
",style=filled, fillcolor=blue";
1059 rawstr <<
",style=filled, fillcolor=yellow";
1062 rawstr <<
",style=filled, fillcolor=gray";
1066 return rawstr.str();
1069 template<
class EdgeIter>
1072 SVFGEdge* edge = *(EI.getCurrent());
1073 assert(edge &&
"No edge found!!");
1074 if (SVFUtil::isa<DirectSVFGEdge>(edge))
1076 if (SVFUtil::isa<CallDirSVFGEdge>(edge))
1077 return "style=solid,color=red";
1078 else if (SVFUtil::isa<RetDirSVFGEdge>(edge))
1079 return "style=solid,color=blue";
1081 return "style=solid";
1083 else if (SVFUtil::isa<IndirectSVFGEdge>(edge))
1085 if (SVFUtil::isa<CallIndSVFGEdge>(edge))
1086 return "style=dashed,color=red";
1087 else if (SVFUtil::isa<RetIndSVFGEdge>(edge))
1088 return "style=dashed,color=blue";
1090 return "style=dashed";
1095 template<
class EdgeIter>
1098 SVFGEdge* edge = *(EI.getCurrent());
1099 assert(edge &&
"No edge found!!");
1102 std::stringstream rawstr(str);
1103 if (
CallDirSVFGEdge* dirCall = SVFUtil::dyn_cast<CallDirSVFGEdge>(edge))
1104 rawstr << dirCall->getCallSiteId();
1105 else if (
RetDirSVFGEdge* dirRet = SVFUtil::dyn_cast<RetDirSVFGEdge>(edge))
1106 rawstr << dirRet->getCallSiteId();
1107 else if (
CallIndSVFGEdge* indCall = SVFUtil::dyn_cast<CallIndSVFGEdge>(edge))
1108 rawstr << indCall->getCallSiteId();
1109 else if (
RetIndSVFGEdge* indRet = SVFUtil::dyn_cast<RetIndSVFGEdge>(edge))
1110 rawstr << indRet->getCallSiteId();
1112 return rawstr.str();
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
virtual const std::string toString() const
virtual const std::string toString() const
const CallICFGNode * getCallSite() const
Return callsite.
const RetICFGNode * getRetICFGNode() const
Return callsite.
virtual const std::string toString() const
const CallICFGNode * getCallSite() const
Return callsite.
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const SVFFunction * getFunction() const
Return function.
iterator begin()
Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
IDToNodeMapTy::iterator iterator
Node Iterators.
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
static void WriteGraphToFile(SVF::OutStream &O, const std::string &GraphName, const GraphType >, bool simple=false)
virtual const SVFFunction * getFun() const
Return the function of this ICFGNode.
FunEntryICFGNode * getFunEntryICFGNode(const SVFFunction *fun)
Add a function entry node.
FunExitICFGNode * getFunExitICFGNode(const SVFFunction *fun)
Add a function exit node.
NodeID getVarargNode(const SVFFunction *func) const
getVarargNode - Return the unique node representing the variadic argument of a variadic function.
virtual const std::string toString() const
bool addPointsTo(const NodeBS &c)
Handle memory region.
virtual const std::string toString() const
virtual const std::string toString() const
virtual const std::string toString() const
virtual const std::string toString() const override
const NodeBS & getPointsTo() const
Return points-to of the MR.
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const MemRegion * getMR() const
Return the memory region.
MRVer * getResVer() const
Set operand vers.
MRVer * getMRVer() const
Get Ver.
virtual const std::string toString() const
OPVers::const_iterator opVerEnd() const
OPVers::const_iterator opVerBegin() const
Operand ver iterators.
const SVFBasicBlock * getBasicBlock() const
Return the basic block.
const NodeBS & getPointsTo() const
Return points-to.
static const Option< std::string > ReadSVFG
static const Option< std::string > WriteSVFG
static const Option< bool > ShowHiddenNode
Set< const CallICFGNode * > CallInstSet
virtual const std::string toString() const
const SVFFunction * getFunction() const
Return function.
NodeID getId() const
Get ID.
const ICFGNode * front() const
virtual void performStat() override
bool inBackwardSlice(const SVFGNode *node) const
bool isSource(const SVFGNode *node) const
bool inForwardSlice(const SVFGNode *node) const
bool isSink(const SVFGNode *node) const
SVFG(std::unique_ptr< MemSSA > mssa, VFGK k)
Constructor.
virtual void buildSVFG()
Start building SVFG.
void connectIndirectSVFGEdges()
Connect direct SVFG edges between two SVFG nodes (value-flow of top address-taken variables)
SVFGEdge * addThreadMHPIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts)
bool hasFuncEntryChi(const SVFFunction *func) const
Has function for EntryCHI/RetMU/CallCHI/CallMU.
FormalOUTSVFGNodeSet & getFormalOUTSVFGNodes(const SVFFunction *fun)
bool hasFuncRetMu(const SVFFunction *func) const
virtual void connectFOutAndAOut(const FormalOUTSVFGNode *formalOut, const ActualOUTSVFGNode *actualOut, CallSiteID csId, SVFGEdgeSetTy &edges)
Connect formal-out and actual-out.
ActualINSVFGNodeSet & getActualINSVFGNodes(const CallICFGNode *cs)
Get SVFGNode set.
void getInterVFEdgesForIndirectCallSite(const CallICFGNode *cs, const SVFFunction *callee, SVFGEdgeSetTy &edges)
Get all inter value flow edges of a indirect call site.
SVFGEdge * addInterIndirectVFCallEdge(const ActualINSVFGNode *src, const FormalINSVFGNode *dst, CallSiteID csId)
Add inter VF edge from callsite mu to function entry chi.
void connectFromGlobalToProgEntry()
Connect indirect SVFG edges from global initializers (store) to main function entry.
ActualOUTSVFGNodeSet & getActualOUTSVFGNodes(const CallICFGNode *cs)
void dump(const std::string &file, bool simple=false)
Dump graph into dot file.
void addIntraMSSAPHISVFGNode(ICFGNode *BlockICFGNode, const Map< u32_t, const MRVer * >::const_iterator opVerBegin, const Map< u32_t, const MRVer * >::const_iterator opVerEnd, const MRVer *resVer, const NodeID nodeId)
Add memory SSA PHI SVFG node.
bool addSVFGEdge(SVFGEdge *edge)
Add SVFG edge.
void addActualOUTSVFGNode(const CallICFGNode *callsite, const MRVer *resVer, const NodeID nodeId)
Add memory callsite chi SVFG node.
virtual void getInterVFEdgeAtIndCSFromFOutToAOut(ActualOUTSVFGNode *actualOut, const SVFFunction *callee, SVFGEdgeSetTy &edges)
SVFGNode * getSVFGNode(NodeID id) const
Get a SVFG node.
virtual void writeToFile(const std::string &filename)
void addFormalOUTSVFGNode(const FunExitICFGNode *funExit, const MRVer *ver, const NodeID nodeId)
Add memory Function return mu SVFG node.
void destroy()
Clean up memory.
bool hasCallSiteMu(const CallICFGNode *cs) const
SVFGStat * getStat() const
Return statistics.
SVFGEdge * addRetIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts, CallSiteID csId)
void addActualINSVFGNode(const CallICFGNode *callsite, const MRVer *ver, const NodeID nodeId)
Add memory callsite mu SVFG node.
FormalINSVFGNodeSet & getFormalINSVFGNodes(const SVFFunction *fun)
virtual void readFile(const std::string &filename)
std::unique_ptr< MemSSA > mssa
virtual void getInterVFEdgeAtIndCSFromFRToAR(const PAGNode *fun_ret, const PAGNode *cs_ret, CallSiteID csId, SVFGEdgeSetTy &edges)
void addFormalINSVFGNode(const FunEntryICFGNode *funEntry, const MRVer *resVer, const NodeID nodeId)
Add memory Function entry chi SVFG node.
NodeID getDef(const PAGNode *pagNode) const
void addSVFGNodesForAddrTakenVars()
Create SVFG nodes for address-taken variables.
virtual void getInterVFEdgeAtIndCSFromAPToFP(const PAGNode *cs_arg, const PAGNode *fun_arg, const CallICFGNode *, CallSiteID csId, SVFGEdgeSetTy &edges)
Get inter value flow edges between indirect call site and callee.
SVFGEdge * addInterIndirectVFRetEdge(const FormalOUTSVFGNode *src, const ActualOUTSVFGNode *dst, CallSiteID csId)
Add inter VF edge from function exit mu to callsite chi.
virtual void connectAInAndFIn(const ActualINSVFGNode *actualIn, const FormalINSVFGNode *formalIn, CallSiteID csId, SVFGEdgeSetTy &edges)
Connect SVFG nodes between caller and callee for indirect call site.
void setDef(const PAGNode *pagNode, const SVFGNode *node)
Given a PAGNode, set/get its def SVFG node (definition of top level pointers)
SVFGEdge * addIntraIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts)
Add indirect def-use edges of a memory region between two statements,.
const CallICFGNode * isCallSiteRetSVFGNode(const SVFGNode *node) const
Whether a node is callsite return SVFGNode.
bool hasCallSiteChi(const CallICFGNode *cs) const
void performStat()
Perform statistics.
const SVFFunction * isFunEntrySVFGNode(const SVFGNode *node) const
Whether a node is function entry SVFGNode.
void clearMSSA()
Clear MSSA.
virtual void connectCallerAndCallee(const CallICFGNode *cs, const SVFFunction *callee, SVFGEdgeSetTy &edges)
Connect SVFG nodes between caller and callee for indirect call site.
SVFGEdge * addCallIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts, CallSiteID csId)
virtual void getInterVFEdgeAtIndCSFromAInToFIn(ActualINSVFGNode *actualIn, const SVFFunction *callee, SVFGEdgeSetTy &edges)
const SVFVarList & getCallSiteArgsList(const CallICFGNode *cs) const
Get callsite argument list.
const SVFVar * getCallSiteRet(const RetICFGNode *cs) const
Get callsite return.
const SVFVar * getFunRet(const SVFFunction *func) const
Get function return list.
std::vector< const SVFVar * > SVFVarList
bool hasCallSiteArgsMap(const CallICFGNode *cs) const
Callsite has argument list.
const SVFVarList & getFunArgsList(const SVFFunction *func) const
Get function arguments list.
bool callsiteHasRet(const RetICFGNode *cs) const
bool hasFunArgsList(const SVFFunction *func) const
Function has arguments list.
bool funHasRet(const SVFFunction *func) const
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
bool intersects(const SparseBitVector< ElementSize > *RHS) const
virtual const std::string toString() const
virtual SVFStmt::SVFStmtSetTy & getPAGEdgeSet(SVFStmt::PEDGEK kind)
Get PAGEdge set.
StmtVFGNode * getStmtVFGNode(const PAGEdge *pagEdge) const
Get an VFGNode.
void checkIntraEdgeParents(const VFGNode *srcNode, const VFGNode *dstNode)
sanitize Intra edges, verify that both nodes belong to the same function.
CallSiteID getCallSiteID(const CallICFGNode *cs, const SVFFunction *func) const
Get callsite given a callsiteID.
GlobalVFGNodeSet globalVFGNodes
set of global store VFG nodes
virtual bool isInterestedPAGNode(const SVFVar *node) const
virtual void connectCallerAndCallee(const CallICFGNode *cs, const SVFFunction *callee, VFGEdgeSetTy &edges)
Connect VFG nodes between caller and callee for indirect call site.
VFGEdge * hasIntraVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind)
Whether we has a SVFG edge.
VFGEdge::SVFGEdgeSetTy SVFGEdgeSetTy
VFGEdge * hasInterVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind, CallSiteID csId)
VFGEdge * hasThreadVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind)
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
constexpr std::remove_reference< T >::type && move(T &&t) noexcept
std::ostream & outs()
Overwrite llvm::outs()
const SVFFunction * getProgEntryFunction()
Get program entry function.
static std::string getGraphName(SVFG *)
Return name of the graph.
std::string getNodeLabel(NodeType *node, SVFG *graph)
static std::string getEdgeSourceLabel(NodeType *, EdgeIter EI)
static std::string getSimpleNodeLabel(NodeType *node, SVFG *)
Return label of a VFG node without MemSSA information.
static bool isNodeHidden(SVFGNode *node, SVFG *)
DOTGraphTraits(bool isSimple=false)
static std::string getNodeAttributes(NodeType *node, SVFG *graph)
static std::string getCompleteNodeLabel(NodeType *node, SVFG *)
Return label of a VFG node with MemSSA information.
static std::string getEdgeAttributes(NodeType *, EdgeIter EI, SVFG *)