38 using namespace SVFUtil;
43 std::stringstream rawstr(str);
44 rawstr <<
"VFGNode ID: " << getId() <<
" ";
51 std::stringstream rawstr(str);
52 rawstr <<
"StmtVFGNode ID: " << getId() <<
" ";
53 rawstr << getPAGEdge()->toString();
60 nb.
set(getPAGDstNodeID());
67 std::stringstream rawstr(str);
68 rawstr <<
"LoadVFGNode ID: " << getId() <<
" ";
69 rawstr << getPAGEdge()->toString();
76 for (
auto edge: getOutEdges())
80 nb |= iedge->getPointsTo();
89 std::stringstream rawstr(str);
90 rawstr <<
"StoreVFGNode ID: " << getId() <<
" ";
91 rawstr << getPAGEdge()->toString();
98 nb.
set(getPAGDstNodeID());
105 std::stringstream rawstr(str);
106 rawstr <<
"CopyVFGNode ID: " << getId() <<
" ";
107 rawstr << getPAGEdge()->toString();
114 nb.
set(getRes()->getId());
121 std::stringstream rawstr(str);
122 rawstr <<
"CmpVFGNode ID: " << getId() <<
" ";
123 rawstr <<
"PAGEdge: [" << res->getId() <<
" = cmp(";
124 for(CmpVFGNode::OPVers::const_iterator it = opVerBegin(), eit = opVerEnd();
126 rawstr << it->second->getId() <<
", ";
130 rawstr <<
" " << res->getValue()->toString();
138 nb.
set(getRes()->getId());
145 std::stringstream rawstr(str);
146 rawstr <<
"BinaryOPVFGNode ID: " << getId() <<
" ";
147 rawstr <<
"PAGEdge: [" << res->getId() <<
" = Binary(";
148 for(BinaryOPVFGNode::OPVers::const_iterator it = opVerBegin(), eit = opVerEnd();
150 rawstr << it->second->getId() <<
", ";
154 rawstr <<
" " << res->getValue()->toString();
162 nb.
set(getRes()->getId());
169 std::stringstream rawstr(str);
170 rawstr <<
"UnaryOPVFGNode ID: " << getId() <<
" ";
171 rawstr <<
"PAGEdge: [" << res->getId() <<
" = Unary(";
172 for(UnaryOPVFGNode::OPVers::const_iterator it = opVerBegin(), eit = opVerEnd();
174 rawstr << it->second->getId() <<
", ";
178 rawstr <<
" " << res->getValue()->toString();
191 std::stringstream rawstr(str);
192 rawstr <<
"BranchVFGNode ID: " << getId() <<
" ";
193 rawstr <<
"PAGEdge: [" << brstmt->toString() <<
"\t";
200 nb.
set(getPAGDstNodeID());
207 std::stringstream rawstr(str);
208 rawstr <<
"GepVFGNode ID: " << getId() <<
" ";
209 rawstr << getPAGEdge()->toString();
216 nb.
set(getRes()->getId());
223 std::stringstream rawstr(str);
224 rawstr <<
"PHIVFGNode ID: " << getId() <<
" ";
225 rawstr <<
"PAGNode: [" << res->getId() <<
" = PHI(";
226 for(PHIVFGNode::OPVers::const_iterator it = opVerBegin(), eit = opVerEnd();
228 rawstr << it->second->getId() <<
", ";
232 rawstr <<
" " << res->getValue()->toString();
241 std::stringstream rawstr(str);
242 rawstr <<
"IntraPHIVFGNode ID: " << getId() <<
" ";
243 rawstr <<
"PAGNode: [" << res->getId() <<
" = PHI(";
244 for(PHIVFGNode::OPVers::const_iterator it = opVerBegin(), eit = opVerEnd();
246 rawstr << it->second->getId() <<
", ";
250 rawstr <<
" " << res->getValue()->toString();
258 nb.
set(getPAGDstNodeID());
265 std::stringstream rawstr(str);
266 rawstr <<
"AddrVFGNode ID: " << getId() <<
" ";
267 rawstr << getPAGEdge()->toString();
275 std::stringstream rawstr(str);
276 rawstr <<
"ArgumentVFGNode ID: " << getId() <<
" ";
277 rawstr << param->toString();
284 nb.
set(getParam()->getId());
291 std::stringstream rawstr(str);
292 rawstr <<
"ActualParmVFGNode ID: " << getId() <<
" ";
293 rawstr <<
"CS[" << getCallSite()->getSourceLoc() <<
"]";
294 rawstr << param->toString();
301 nb.
set(getParam()->getId());
308 std::stringstream rawstr(str);
309 rawstr <<
"FormalParmVFGNode ID: " << getId() <<
" ";
310 rawstr <<
"Fun[" << getFun()->getName() <<
"]";
311 rawstr << param->toString();
318 nb.
set(getRev()->getId());
325 std::stringstream rawstr(str);
326 rawstr <<
"ActualRetVFGNode ID: " << getId() <<
" ";
327 rawstr <<
"CS[" << getCallSite()->getSourceLoc() <<
"]";
328 rawstr << param->toString();
336 nb.
set(getRet()->getId());
343 std::stringstream rawstr(str);
344 rawstr <<
"FormalRetVFGNode ID: " << getId() <<
" ";
345 rawstr <<
"Fun[" << getFun()->getName() <<
"]";
346 rawstr << param->toString();
354 std::stringstream rawstr(str);
355 if(isFormalParmPHI())
356 rawstr <<
"FormalParmPHI ID: " << getId() <<
" PAGNode ID: " << res->getId() <<
"\n" << res->getValue()->toString();
358 rawstr <<
"ActualRetPHI ID: " << getId() <<
" PAGNode ID: " << res->getId() <<
"\n" << res->getValue()->toString();
365 nb.
set(getPAGNode()->getId());
372 std::stringstream rawstr(str);
373 rawstr <<
"NullPtrVFGNode ID: " << getId();
374 rawstr <<
" PAGNode ID: " << node->getId() <<
"\n";
382 std::stringstream rawstr(str);
383 rawstr <<
"VFGEdge: [" << getDstID() <<
"<--" << getSrcID() <<
"]\t";
390 std::stringstream rawstr(str);
391 rawstr <<
"DirectVFGEdge: [" << getDstID() <<
"<--" << getSrcID() <<
"]\t";
398 std::stringstream rawstr(str);
399 rawstr <<
"IntraDirSVFGEdge: [" << getDstID() <<
"<--" << getSrcID() <<
"]\t";
406 std::stringstream rawstr(str);
407 rawstr <<
"CallDirSVFGEdge CallSite ID: " << getCallSiteId() <<
" [";
408 rawstr << getDstID() <<
"<--" << getSrcID() <<
"]\t";
415 std::stringstream rawstr(str);
416 rawstr <<
"RetDirSVFGEdge CallSite ID: " << getCallSiteId() <<
" [";
417 rawstr << getDstID() <<
"<--" << getSrcID() <<
"]\t";
473 for (SVFStmt::SVFStmtSetTy::iterator iter = addrs.begin(), eiter =
474 addrs.end(); iter != eiter; ++iter)
481 for (SVFStmt::SVFStmtSetTy::iterator iter = copys.begin(), eiter =
482 copys.end(); iter != eiter; ++iter)
484 const CopyStmt* edge = SVFUtil::cast<CopyStmt>(*iter);
485 assert(!
isPhiCopyEdge(edge) &&
"Copy edges can not be a PhiNode (or from PhiNode)");
491 for (SVFStmt::SVFStmtSetTy::iterator iter = ngeps.begin(), eiter =
492 ngeps.end(); iter != eiter; ++iter)
499 for (SVFStmt::SVFStmtSetTy::iterator iter = loads.begin(), eiter =
500 loads.end(); iter != eiter; ++iter)
507 for (SVFStmt::SVFStmtSetTy::iterator iter = stores.begin(), eiter =
508 stores.end(); iter != eiter; ++iter)
514 for (SVFStmt::SVFStmtSetTy::iterator iter = forks.begin(), eiter =
515 forks.end(); iter != eiter; ++iter)
517 TDForkPE* forkedge = SVFUtil::cast<TDForkPE>(*iter);
525 for(SVFIR::SVFVarList::iterator pit = it->second.begin(), epit = it->second.end(); pit!=epit; ++pit)
551 for(SVFIR::SVFVarList::iterator pit = it->second.begin(), epit = it->second.end(); pit!=epit; ++pit)
563 CallPE* callPE = SVFUtil::cast<CallPE>(*cit);
565 callPEs.insert(callPE);
583 CallPE* callPE = SVFUtil::cast<CallPE>(*cit);
585 callPEs.insert(callPE);
597 const PAGNode* uniqueFunRetNode = it->second;
606 const RetPE* retPE = SVFUtil::cast<RetPE>(*cit);
608 retPEs.insert(retPE);
618 for (SVFStmt::SVFStmtSetTy::iterator iter = phis.begin(), eiter =
619 phis.end(); iter != eiter; ++iter)
621 const PhiStmt* edge = SVFUtil::cast<PhiStmt>(*iter);
627 for (SVFStmt::SVFStmtSetTy::iterator iter = selects.begin(), eiter =
628 selects.end(); iter != eiter; ++iter)
630 const MultiOpndStmt* edge = SVFUtil::cast<MultiOpndStmt>(*iter);
636 for (SVFStmt::SVFStmtSetTy::iterator iter = binaryops.begin(), eiter =
637 binaryops.end(); iter != eiter; ++iter)
639 const BinaryOPStmt* edge = SVFUtil::cast<BinaryOPStmt>(*iter);
645 for (SVFStmt::SVFStmtSetTy::iterator iter = unaryops.begin(), eiter =
646 unaryops.end(); iter != eiter; ++iter)
648 const UnaryOPStmt* edge = SVFUtil::cast<UnaryOPStmt>(*iter);
654 for (SVFStmt::SVFStmtSetTy::iterator iter = brs.begin(), eiter =
655 brs.end(); iter != eiter; ++iter)
657 const BranchStmt* edge = SVFUtil::cast<BranchStmt>(*iter);
663 for (SVFStmt::SVFStmtSetTy::iterator iter = cmps.begin(), eiter =
664 cmps.end(); iter != eiter; ++iter)
666 const CmpStmt* edge = SVFUtil::cast<CmpStmt>(*iter);
683 assert(edge->
isDirectVFGEdge() &&
"this should be a direct value flow edge!");
691 return (
addVFGEdge(directEdge) ? directEdge :
nullptr);
714 return (
addVFGEdge(callEdge) ? callEdge :
nullptr);
734 return (
addVFGEdge(retEdge) ? retEdge :
nullptr);
747 NodeID nodeId = it->first;
750 if(
StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
753 if(SVFUtil::isa<AddrVFGNode>(stmtNode))
756 if (stmtNode->getPAGSrcNode()->isConstDataOrAggDataButNotNullPtr() ==
false)
760 if (
const GepStmt* gepStmt = SVFUtil::dyn_cast<GepStmt>(stmtNode->getPAGEdge()))
762 for (
const auto &varType: gepStmt->getOffsetVarAndGepTypePairVec())
764 if(varType.first->isConstDataOrAggDataButNotNullPtr() ||
isInterestedPAGNode(varType.first) ==
false)
770 if(SVFUtil::isa<StoreVFGNode>(stmtNode) && (stmtNode->getPAGDstNode()->isConstDataOrAggDataButNotNullPtr() ==
false))
776 else if(
PHIVFGNode* phiNode = SVFUtil::dyn_cast<PHIVFGNode>(node))
778 for (PHIVFGNode::OPVers::const_iterator it = phiNode->opVerBegin(), eit = phiNode->opVerEnd(); it != eit; it++)
780 if (it->second->isConstDataOrAggDataButNotNullPtr() ==
false)
784 else if(
BinaryOPVFGNode* binaryNode = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
786 for (BinaryOPVFGNode::OPVers::const_iterator it = binaryNode->opVerBegin(), eit = binaryNode->opVerEnd(); it != eit; it++)
788 if (it->second->isConstDataOrAggDataButNotNullPtr() ==
false)
792 else if(
UnaryOPVFGNode* unaryNode = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
794 for (UnaryOPVFGNode::OPVers::const_iterator it = unaryNode->opVerBegin(), eit = unaryNode->opVerEnd(); it != eit; it++)
796 if (it->second->isConstDataOrAggDataButNotNullPtr() ==
false)
800 else if(
CmpVFGNode* cmpNode = SVFUtil::dyn_cast<CmpVFGNode>(node))
802 for (CmpVFGNode::OPVers::const_iterator it = cmpNode->opVerBegin(), eit = cmpNode->opVerEnd(); it != eit; it++)
804 if (it->second->isConstDataOrAggDataButNotNullPtr() ==
false)
808 else if(
BranchVFGNode* branchNode = SVFUtil::dyn_cast<BranchVFGNode>(node))
810 const SVFVar* cond = branchNode->getBranchStmt()->getCondition();
814 else if(
ActualParmVFGNode* actualParm = SVFUtil::dyn_cast<ActualParmVFGNode>(node))
816 if (actualParm->getParam()->isConstDataOrAggDataButNotNullPtr() ==
false)
819 else if(
FormalParmVFGNode* formalParm = SVFUtil::dyn_cast<FormalParmVFGNode>(node))
821 for(CallPESet::const_iterator it = formalParm->callPEBegin(), eit = formalParm->callPEEnd();
829 else if(
FormalRetVFGNode* calleeRet = SVFUtil::dyn_cast<FormalRetVFGNode>(node))
835 for(RetPESet::const_iterator it = calleeRet->retPEBegin(), eit = calleeRet->retPEEnd(); it!=eit; ++it)
838 const CallICFGNode* callBlockNode = (*it)->getCallSite();
851 for (SVFStmt::SVFStmtSetTy::iterator iter = forks.begin(), eiter =
852 forks.end(); iter != eiter; ++iter)
854 TDForkPE* forkedge = SVFUtil::cast<TDForkPE>(*iter);
861 for (SVFStmt::SVFStmtSetTy::iterator iter = joins.begin(), eiter =
862 joins.end(); iter != eiter; ++iter)
864 TDJoinPE* joinedge = SVFUtil::cast<TDJoinPE>(*iter);
880 if (outEdge && inEdge)
882 assert(outEdge == inEdge &&
"edges not match");
898 if (outEdge && inEdge)
900 assert(outEdge == inEdge &&
"edges not match");
915 if (outEdge && inEdge)
917 assert(outEdge == inEdge &&
"edges not match");
954 PointerAnalysis::CallEdgeMap::const_iterator iter = pta->
getIndCallMap().begin();
955 PointerAnalysis::CallEdgeMap::const_iterator eiter = pta->
getIndCallMap().end();
956 for (; iter != eiter; iter++)
959 assert(newcs->
isIndirectCall() &&
"this is not an indirect call?");
961 for (PointerAnalysis::FunctionSet::const_iterator func_iter = functions.begin(); func_iter != functions.end(); func_iter++)
984 SVFIR::SVFVarList::const_iterator csArgIt = csArgList.begin(), csArgEit = csArgList.end();
985 SVFIR::SVFVarList::const_iterator funArgIt = funArgList.begin(), funArgEit = funArgList.end();
986 for (; funArgIt != funArgEit && csArgIt != csArgEit; funArgIt++, csArgIt++)
988 const PAGNode *cs_arg = *csArgIt;
989 const PAGNode *fun_arg = *funArgIt;
993 assert(funArgIt == funArgEit &&
"function has more arguments than call site");
1001 for (; csArgIt != csArgEit; csArgIt++)
1003 const PAGNode *cs_arg = *csArgIt;
1027 if(
const AddrVFGNode* addr = SVFUtil::dyn_cast<AddrVFGNode>(node))
1028 return addr->getPAGDstNode();
1029 else if(
const CopyVFGNode*
copy = SVFUtil::dyn_cast<CopyVFGNode>(node))
1030 return copy->getPAGDstNode();
1031 else if(
const GepVFGNode* gep = SVFUtil::dyn_cast<GepVFGNode>(node))
1032 return gep->getPAGDstNode();
1033 else if(
const LoadVFGNode* load = SVFUtil::dyn_cast<LoadVFGNode>(node))
1034 return load->getPAGDstNode();
1035 else if(
const PHIVFGNode* phi = SVFUtil::dyn_cast<PHIVFGNode>(node))
1036 return phi->getRes();
1037 else if(
const CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
1038 return cmp->getRes();
1039 else if(
const BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
1040 return bop->getRes();
1041 else if(
const UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
1042 return uop->getRes();
1043 else if(
const ActualParmVFGNode* ap = SVFUtil::dyn_cast<ActualParmVFGNode>(node))
1044 return ap->getParam();
1045 else if(
const FormalParmVFGNode*fp = SVFUtil::dyn_cast<FormalParmVFGNode>(node))
1046 return fp->getParam();
1047 else if(
const ActualRetVFGNode* ar = SVFUtil::dyn_cast<ActualRetVFGNode>(node))
1048 return ar->getRev();
1049 else if(
const FormalRetVFGNode* fr = SVFUtil::dyn_cast<FormalRetVFGNode>(node))
1050 return fr->getRet();
1051 else if(
const NullPtrVFGNode* nullVFG = SVFUtil::dyn_cast<NullPtrVFGNode>(node))
1052 return nullVFG->getPAGNode();
1054 assert(
false &&
"unexpected node kind!");
1065 return fp->getFun();
1067 else if(
const InterPHIVFGNode* phi = SVFUtil::dyn_cast<InterPHIVFGNode>(node))
1069 if(phi->isFormalParmPHI())
1070 return phi->getFun();
1125 return getSimpleNodeLabel(node, graph);
1127 return getCompleteNodeLabel(node, graph);
1134 std::stringstream rawstr(str);
1135 if(
StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1137 rawstr << stmtNode->toString();
1139 else if(
PHIVFGNode* tphi = SVFUtil::dyn_cast<PHIVFGNode>(node))
1141 rawstr << tphi->toString();
1145 rawstr << fp->toString();
1149 rawstr << ap->toString();
1153 rawstr << ar->toString();
1157 rawstr << fr->toString();
1159 else if(SVFUtil::isa<NullPtrVFGNode>(node))
1161 rawstr <<
"NullPtr";
1163 else if(
BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
1165 rawstr << bop->toString();
1167 else if(
UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
1169 rawstr << uop->toString();
1171 else if(
CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
1173 rawstr << cmp->toString();;
1175 else if (
BranchVFGNode* branchNode = SVFUtil::dyn_cast<BranchVFGNode>(node))
1177 rawstr << branchNode->toString();
1180 assert(
false &&
"what else kinds of nodes do we have??");
1182 return rawstr.str();
1190 std::stringstream rawstr(str);
1191 if(
StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1193 rawstr << stmtNode->toString();
1195 else if(
BinaryOPVFGNode* bop = SVFUtil::dyn_cast<BinaryOPVFGNode>(node))
1197 rawstr << bop->toString();
1199 else if(
UnaryOPVFGNode* uop = SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
1201 rawstr << uop->toString();
1203 else if(
CmpVFGNode* cmp = SVFUtil::dyn_cast<CmpVFGNode>(node))
1205 rawstr << cmp->toString();
1207 else if(
PHIVFGNode* phi = SVFUtil::dyn_cast<PHIVFGNode>(node))
1209 rawstr << phi->toString();
1213 rawstr << fp->toString();
1217 rawstr << ap->toString();
1219 else if(
NullPtrVFGNode* nptr = SVFUtil::dyn_cast<NullPtrVFGNode>(node))
1221 rawstr << nptr->toString();
1225 rawstr << ar->toString();
1229 rawstr << fr->toString();
1231 else if (
MRSVFGNode* mr = SVFUtil::dyn_cast<MRSVFGNode>(node))
1233 rawstr << mr->toString();
1235 else if (
BranchVFGNode* branchNode = SVFUtil::dyn_cast<BranchVFGNode>(node))
1237 rawstr << branchNode->toString();
1240 assert(
false &&
"what else kinds of nodes do we have??");
1242 return rawstr.str();
1248 std::stringstream rawstr(str);
1250 if(
StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
1252 const PAGEdge* edge = stmtNode->getPAGEdge();
1253 if (SVFUtil::isa<AddrStmt>(edge))
1255 rawstr <<
"color=green";
1257 else if (SVFUtil::isa<CopyStmt>(edge))
1259 rawstr <<
"color=black";
1261 else if (SVFUtil::isa<RetPE>(edge))
1263 rawstr <<
"color=black,style=dotted";
1265 else if (SVFUtil::isa<GepStmt>(edge))
1267 rawstr <<
"color=purple";
1269 else if (SVFUtil::isa<StoreStmt>(edge))
1271 rawstr <<
"color=blue";
1273 else if (SVFUtil::isa<LoadStmt>(edge))
1275 rawstr <<
"color=red";
1279 assert(0 &&
"No such kind edge!!");
1283 else if (SVFUtil::isa<CmpVFGNode>(node))
1285 rawstr <<
"color=grey";
1287 else if (SVFUtil::isa<BinaryOPVFGNode>(node))
1289 rawstr <<
"color=grey";
1291 else if (SVFUtil::isa<UnaryOPVFGNode>(node))
1293 rawstr <<
"color=grey";
1295 else if(SVFUtil::isa<PHIVFGNode>(node))
1297 rawstr <<
"color=black";
1299 else if(SVFUtil::isa<NullPtrVFGNode>(node))
1301 rawstr <<
"color=grey";
1303 else if(SVFUtil::isa<FormalParmVFGNode>(node))
1305 rawstr <<
"color=yellow,penwidth=2";
1307 else if(SVFUtil::isa<ActualParmVFGNode>(node))
1309 rawstr <<
"color=yellow,penwidth=2";
1311 else if (SVFUtil::isa<ActualRetVFGNode>(node))
1313 rawstr <<
"color=yellow,penwidth=2";
1315 else if (SVFUtil::isa<FormalRetVFGNode>(node))
1317 rawstr <<
"color=yellow,penwidth=2";
1319 else if (SVFUtil::isa<MRSVFGNode>(node))
1321 rawstr <<
"color=orange,penwidth=2";
1323 else if (SVFUtil::isa<BranchVFGNode>(node))
1325 rawstr <<
"color=gold,penwidth=2";
1328 assert(
false &&
"no such kind of node!!");
1332 return rawstr.str();
1335 template<
class EdgeIter>
1338 VFGEdge* edge = *(EI.getCurrent());
1339 assert(edge &&
"No edge found!!");
1340 if (SVFUtil::isa<DirectSVFGEdge>(edge))
1342 if (SVFUtil::isa<CallDirSVFGEdge>(edge))
1343 return "style=solid,color=red";
1344 else if (SVFUtil::isa<RetDirSVFGEdge>(edge))
1345 return "style=solid,color=blue";
1347 return "style=solid";
1349 else if (SVFUtil::isa<IndirectSVFGEdge>(edge))
1351 if (SVFUtil::isa<CallIndSVFGEdge>(edge))
1352 return "style=dashed,color=red";
1353 else if (SVFUtil::isa<RetIndSVFGEdge>(edge))
1354 return "style=dashed,color=blue";
1356 return "style=dashed";
1360 assert(
false &&
"what else edge we have?");
1365 template<
class EdgeIter>
1368 VFGEdge* edge = *(EI.getCurrent());
1369 assert(edge &&
"No edge found!!");
1372 std::stringstream rawstr(str);
1373 if (
CallDirSVFGEdge* dirCall = SVFUtil::dyn_cast<CallDirSVFGEdge>(edge))
1374 rawstr << dirCall->getCallSiteId();
1375 else if (
RetDirSVFGEdge* dirRet = SVFUtil::dyn_cast<RetDirSVFGEdge>(edge))
1376 rawstr << dirRet->getCallSiteId();
1378 return rawstr.str();
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
const std::string toString() const override
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const std::string toString() const override
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const std::string toString() const override
const std::string toString() const override
const SVFValue * getValue() const override
Return the corresponding LLVM value, if possible, nullptr otherwise.
SVFVar * getLHSVar() const
SVFVar * getRHSVar() const
const SVFValue * getValue() const override
Return the corresponding LLVM value, if possible, nullptr otherwise.
const PAGNode * getRes() const
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const std::string toString() const override
const SVFVar * getBranchInst() const
virtual const std::string toString() const override
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
virtual const std::string toString() const
bool isIndirectCall() const
Return true if this is an indirect call.
const RetICFGNode * getRetICFGNode() const
Return callsite.
const CallICFGNode * getCallSite() const
const SVFValue * getValue() const override
Return the corresponding LLVM value, if possible, nullptr otherwise.
const std::string toString() const override
const PAGNode * getRes() const
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const std::string toString() const override
virtual const std::string toString() const
iterator begin()
Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
IDToNodeMapTy::iterator iterator
Node Iterators.
bool hasIncomingEdge() const
Has incoming/outgoing edge set.
bool hasOutgoingEdge() const
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const std::string toString() const override
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.
NodeID getNullPtr() const
NodeID getVarargNode(const SVFFunction *func) const
getVarargNode - Return the unique node representing the variadic argument of a variadic function.
const std::string toString() const override
virtual const std::string toString() const
const std::string toString() const override
const std::string toString() const override
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const SVFVar * getRes() const
Result SVFVar.
const std::string toString() const override
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
static const Option< bool > EnableThreadCallGraph
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const std::string toString() const override
const PAGNode * getRes() const
PHIVFGNode(NodeID id, const PAGNode *r, VFGNodeK k=TPhi)
Constructor.
const SVFValue * getValue() const override
Return the corresponding LLVM value, if possible, nullptr otherwise.
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
Set< const SVFFunction * > FunctionSet
virtual const std::string toString() const
const CallICFGNode * getCallSite() const
NodeID getId() const
Get ID.
const SVFVarList & getCallSiteArgsList(const CallICFGNode *cs) const
Get callsite argument list.
const SVFVar * getCallSiteRet(const RetICFGNode *cs) const
Get callsite return.
CSToArgsListMap & getCallSiteArgsMap()
Get callsite argument list.
const SVFVar * getFunRet(const SVFFunction *func) const
Get function return list.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
FunToArgsListMap & getFunArgsMap()
Get function arguments list.
std::vector< const SVFVar * > SVFVarList
CSToRetMap & getCallSiteRets()
Get callsite return.
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
FunToRetMap & getFunRets()
Get function return list.
bool hasFunArgsList(const SVFFunction *func) const
Function has arguments list.
bool funHasRet(const SVFFunction *func) const
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
const SVFValue * getValue() const
bool isConstDataOrAggDataButNotNullPtr() const
bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
Has incoming SVFIR statements (edges)
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
Get incoming SVFStmt iterator.
bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
Has outgoing SVFIR statements (edges)
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
Get outgoing SVFStmt iterator.
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const
Get outgoing SVFStmt iterator.
const SVFValue * getValue() const
Get/has methods of the components.
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
Get incoming SVFStmt iterator.
const PAGEdge * getPAGEdge() const
const SVFValue * getValue() const override
Return the corresponding LLVM value, if possible, nullptr otherwise.
const std::string toString() const override
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
const std::string toString() const override
const SVFVar * getRes() const
const NodeBS getDefSVFVars() const override
Return the left hand side SVF Vars.
virtual const std::string toString() const override
static GEdgeFlag makeEdgeFlagWithInvokeID(GEdgeKind k, CallSiteID cs)
Compute the unique edgeFlag value from edge kind and CallSiteID.
bool isRetDirectVFGEdge() const
bool isDirectVFGEdge() const
Get methods of the components.
virtual const std::string toString() const
bool isCallDirectVFGEdge() const
virtual const std::string toString() const
ActualRetVFGNode * getActualRetVFGNode(const PAGNode *aret) const
VFGEdge::VFGEdgeSetTy VFGEdgeSetTy
void updateCallGraph(PointerAnalysis *pta)
Update VFG based on pointer analysis results.
void addStoreVFGNode(const StoreStmt *store)
void addBranchVFGNode(const BranchStmt *edge)
Add a BranchVFGNode.
const PAGNode * getLHSTopLevPtr(const VFGNode *node) const
VFGEdge * addRetEdge(NodeID srcId, NodeID dstId, CallSiteID csId)
virtual void connectAParamAndFParam(const PAGNode *csArg, const PAGNode *funArg, const CallICFGNode *cbn, CallSiteID csId, VFGEdgeSetTy &edges)
Connect VFG nodes between caller and callee for indirect call site.
virtual SVFStmt::SVFStmtSetTy & getPAGEdgeSet(SVFStmt::PEDGEK kind)
Get PAGEdge set.
void addVFGNodes()
Create VFG nodes.
void addLoadVFGNode(const LoadStmt *load)
Add a Load VFG node.
VFGEdge * addIntraDirectVFEdge(NodeID srcId, NodeID dstId)
void checkIntraEdgeParents(const VFGNode *srcNode, const VFGNode *dstNode)
sanitize Intra edges, verify that both nodes belong to the same function.
void addCopyVFGNode(const CopyStmt *copy)
Add a Copy VFG node.
void addGepVFGNode(const GepStmt *gep)
Add a Gep VFG node.
void addNullPtrVFGNode(const PAGNode *pagNode)
CallSiteID getCallSiteID(const CallICFGNode *cs, const SVFFunction *func) const
Get callsite given a callsiteID.
void addActualRetVFGNode(const PAGNode *ret, const CallICFGNode *cs)
Add a callsite Receive VFG node.
void addUnaryOPVFGNode(const UnaryOPStmt *edge)
Add a UnaryOperator VFG node.
void addActualParmVFGNode(const PAGNode *aparm, const CallICFGNode *cs)
ActualParmVFGNode * getActualParmVFGNode(const PAGNode *aparm, const CallICFGNode *cs) const
void addCmpVFGNode(const CmpStmt *edge)
Add a Compare VFG node.
VFGEdge * addInterEdgeFromAPToFP(ActualParmVFGNode *src, FormalParmVFGNode *dst, CallSiteID csId)
Add inter VF edge from actual to formal parameters.
NodeID getDef(const PAGNode *pagNode) const
FormalParmVFGNode * getFormalParmVFGNode(const PAGNode *fparm) const
bool addVFGEdge(VFGEdge *edge)
Add VFG edge.
virtual bool isInterestedPAGNode(const SVFVar *node) const
bool hasBlackHoleConstObjAddrAsDef(const PAGNode *pagNode) const
Whether a PAGNode has a blackhole or const object as its definition.
const SVFFunction * isFunEntryVFGNode(const VFGNode *node) const
Whether a node is function entry VFGNode.
VFG(PTACallGraph *callgraph, VFGK k=FULLSVFG)
Constructor.
bool isPhiCopyEdge(const PAGEdge *copy) const
VFGNode * getVFGNode(NodeID id) const
Get a VFG node.
VFGEdge * addCallEdge(NodeID srcId, NodeID dstId, CallSiteID csId)
virtual void connectCallerAndCallee(const CallICFGNode *cs, const SVFFunction *callee, VFGEdgeSetTy &edges)
Connect VFG nodes between caller and callee for indirect call site.
void addFormalRetVFGNode(const PAGNode *uniqueFunRet, const SVFFunction *fun, RetPESet &retPEs)
virtual void connectFRetAndARet(const PAGNode *funReturn, const PAGNode *csReturn, CallSiteID csId, VFGEdgeSetTy &edges)
Connect formal-ret and actual ret.
bool hasDef(const PAGNode *pagNode) const
FormalRetVFGNode * getFormalRetVFGNode(const PAGNode *fret) const
VFGEdge * addInterEdgeFromFRToAR(FormalRetVFGNode *src, ActualRetVFGNode *dst, CallSiteID csId)
Add inter VF edge from callee return to callsite receive parameter.
FormalRetVFGNode::RetPESet RetPESet
VFGEdge * hasIntraVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind)
Whether we has a SVFG edge.
void addBinaryOPVFGNode(const BinaryOPStmt *edge)
Add a BinaryOperator VFG node.
void addAddrVFGNode(const AddrStmt *addr)
Add an Address VFG node.
VFGEdge * hasInterVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind, CallSiteID csId)
FormalParmVFGNode::CallPESet CallPESet
void connectDirectVFGEdges()
Create edges between VFG nodes within a function.
VFGEdge * getIntraVFGEdge(const VFGNode *src, const VFGNode *dst, VFGEdge::VFGEdgeK kind)
Get a SVFG edge according to src and dst.
void view()
Dump graph into dot file.
VFGEdge * hasThreadVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind)
void dump(const std::string &file, bool simple=false)
Dump graph into dot file.
void destroy()
Clean up memory.
void addIntraPHIVFGNode(const MultiOpndStmt *edge)
Add an llvm PHI VFG node.
void addFormalParmVFGNode(const PAGNode *fparm, const SVFFunction *fun, CallPESet &callPEs)
Add a formal parameter VFG node.
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
bool matchArgs(const CallICFGNode *cs, const SVFFunction *callee)
std::ostream & outs()
Overwrite llvm::outs()
void ViewGraph(const GraphType &G, const std::string &name, bool ShortNames=false, GraphProgram::Name Program=GraphProgram::DOT)
static std::string getCompleteNodeLabel(NodeType *node, VFG *)
Return label of a VFG node with MemSSA information.
static std::string getNodeAttributes(NodeType *node, VFG *)
static std::string getEdgeSourceLabel(NodeType *, EdgeIter EI)
DOTGraphTraits(bool isSimple=false)
static std::string getEdgeAttributes(NodeType *, EdgeIter EI, VFG *)
std::string getNodeLabel(NodeType *node, VFG *graph)
static std::string getSimpleNodeLabel(NodeType *node, VFG *)
Return label of a VFG node without MemSSA information.
static std::string getGraphName(VFG *)
Return name of the graph.