37 std::vector<const SVFBasicBlock *> &path,
38 std::vector<const SVFBasicBlock *> &tgtNodes,
44 tgtNodes.insert(tgtNodes.end(), path.begin() + 1, path.end());
49 for (
const auto &nxt: it->second)
66 std::vector<const SVFBasicBlock *> &tgtNodes)
68 if (succ == LCA)
return;
69 std::vector<const SVFBasicBlock *> path;
96 pred = callNode->getRetICFGNode();
101 if(intraEdge->getCondition())
102 return intraEdge->getSuccessorCondValue();
108 assert(
false &&
"not intra edge?");
126 for (
const auto&
item: *svfirCallGraph)
134 for (
const auto &
item: BBS)
141 getLoopAndDomInfo()->findNearestCommonPDominator(pred, succ);
142 std::vector<const SVFBasicBlock *> tgtNodes;
145 tgtNodes.push_back(succ);
148 if (SVFLCA == pred) tgtNodes.push_back(SVFLCA);
173 for (
const auto &it: *func)
180 res[bb].push_back(succ);
192 for (
const auto &it2: it.second)
195 const ICFGNode *controlNode = it.first->getICFGNodeList().back();
202 controlNode = callNode->getRetICFGNode();
204 if (!controlNode)
continue;
208 _nodeControlMap[controlNode][controllee].insert(it2.second.begin(), it2.second.end());
210 for (
s32_t pos: it2.second)
215 assert(intraNode->getSVFStmts().size() == 1 &&
216 "not a branch stmt?");
219 intraNode->getSVFStmts().front())
221 _controlDG->addCDGEdgeFromSrcDst(controlNode, controllee,
232 controlNode, controllee,
void buildControlDependence()
build control dependence for each function
Map< const ICFGNode *, Map< const ICFGNode *, Set< s32_t > > > _nodeControlMap
map an ICFG node to its controlling ICFG nodes (position, set of Nodes)
static void extractBBS(const FunObjVar *func, Map< const SVFBasicBlock *, std::vector< const SVFBasicBlock * > > &res)
extract basic block edges to be processed
void updateMap(const SVFBasicBlock *pred, const SVFBasicBlock *bb, s32_t pos)
update map
void extractNodesBetweenPdomNodes(const SVFBasicBlock *succ, const SVFBasicBlock *LCA, std::vector< const SVFBasicBlock * > &tgtNodes)
extract nodes between two nodes in pdom tree
void dfsNodesBetweenPdomNodes(const SVFBasicBlock *cur, const SVFBasicBlock *tgt, std::vector< const SVFBasicBlock * > &path, std::vector< const SVFBasicBlock * > &tgtNodes, SVFLoopAndDomInfo *ld)
Map< const SVFBasicBlock *, Map< const SVFBasicBlock *, Set< s32_t > > > _svfcontrolMap
map a basicblock to its controlling BBs (position, set of BBs)
void buildICFGNodeControlMap()
build map at icfg node level
Map< const ICFGNode *, Map< const ICFGNode *, Set< s32_t > > > _nodeDependentOnMap
map an ICFG node to its dependent on ICFG nodes (position, set of Nodes)
s64_t getBBSuccessorBranchID(const SVFBasicBlock *BB, const SVFBasicBlock *Succ)
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
SVFLoopAndDomInfo * getLoopAndDomInfo() const
ICFGEdge * getICFGEdge(const ICFGNode *src, const ICFGNode *dst, ICFGEdge::ICFGEdgeK kind)
Get a SVFG edge according to src and dst.
NodeID getNullPtr() const
const std::vector< const ICFGNode * > & getICFGNodeList() const
const FunObjVar * getFunction() const
const ICFGNode * front() const
const ICFGNode * back() const
std::vector< const SVFBasicBlock * > getSuccessors() const
const CallGraph * getCallGraph()
Get CG.
const SVFVar * getSVFVar(NodeID id) const
ObjVar/GepObjVar/BaseObjVar.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
const Map< const SVFBasicBlock *, BBSet > & getPostDomTreeMap() const
std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > cast(const Y &Val)
bool isExtCall(const FunObjVar *fun)
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map