158 for (
auto eit =
v->InEdgeBegin();
eit !=
v->InEdgeEnd(); ++
eit)
161 SVFUtil::dyn_cast<IndirectSVFGEdge>(*
eit);
165 SVFUtil::dyn_cast<SVFGNode>(
indEdge->getSrcNode());
166 assert(src &&
"SVFG incoming edge must have a source node");
167 assert(
v &&
"SVFG incoming edge must have a destination node");
172 assert(
srcICFG &&
"SVFG source node must have an ICFG node");
174 "SVFG destination node must have an ICFG node");
186 if (SVFUtil::isa<GepObjVar>(
gn))
190 else if (
auto* base = SVFUtil::dyn_cast<BaseObjVar>(
gn))
246 if (SVFUtil::isa<StoreVFGNode>(
vfgNode) &&
247 vfgNode->getDefSVFVars().intersects(
edge->getPointsTo()))
257 assert(
edge &&
"Indirect SVFG edge must exist");
258 assert(dst &&
"Indirect SVFG edge must have a destination node");
260 const SVFGNode* src = SVFUtil::dyn_cast<SVFGNode>(
edge->getSrcNode());
261 assert(src &&
"Indirect SVFG edge must have an SVFG source node");
265 assert(
srcICFG &&
"SVFG source node must have an ICFG node");
266 assert(
dstICFG &&
"SVFG destination node must have an ICFG node");
274 else if (!fun || fun !=
dstICFG->getFun())
281 std::deque<const ICFGNode*> worklist;
286 while (!worklist.empty() && !
feasible)
288 const ICFGNode* cur = worklist.front();
289 worklist.pop_front();
302 SVFUtil::dyn_cast<CallICFGNode>(cur))
313 else if (!visited.count(
succ))
315 visited.insert(
succ);
316 worklist.push_back(
succ);
327 SVFUtil::dyn_cast<IntraCFGEdge>(
icfgEdge);
335 else if (!
succ ||
succ->getFun() != fun)
347 else if (!visited.count(
succ))
349 visited.insert(
succ);
350 worklist.push_back(
succ);
379 if (!fun || fun != dst->
getFun())
386 std::deque<const ICFGNode*> worklist;
388 worklist.push_back(src);
391 while (!worklist.empty() && !
feasible)
393 const ICFGNode* cur = worklist.front();
394 worklist.pop_front();
401 SVFUtil::dyn_cast<CallICFGNode>(cur))
408 else if (
succ == dst)
412 else if (!visited.count(
succ))
414 visited.insert(
succ);
415 worklist.push_back(
succ);
426 SVFUtil::dyn_cast<IntraCFGEdge>(
edge);
434 else if (!
succ ||
succ->getFun() != fun)
442 else if (
succ == dst)
446 else if (!visited.count(
succ))
448 visited.insert(
succ);
449 worklist.push_back(
succ);
467 if (!
edge->getCondition())
538 auto eit =
pit->second.find(
it->first);
539 if (
eit ==
pit->second.end())
545 it->second.join_with(
eit->second);
564 rit->second.meet_with(
val);
583 if (
trace.inAddrToValTable(
id))
631 for (
const auto& [
id,
val] :
next.getVarToVal())
650 for (
const auto& [
id,
val] :
next.getVarToVal())
692 if (!
var->getICFGNode())
697 else if (SVFUtil::isa<CallICFGNode>(
var->getICFGNode()) &&
698 SVFUtil::isa<RetValPN>(
var))
700 return SVFUtil::dyn_cast<CallICFGNode>(
var->getICFGNode())
707 return var->getICFGNode();
static bool hasRedefineToSameObj(const ICFGNode *node, const IndirectSVFGEdge *edge)
AndersenWaveDiff * getPointerAnalysis() const
Accessors for Andersen's results.
const Set< const ValVar * > getCycleValVars(const ICFGCycleWTO *cycle) const
AbstractState & getAbsState(const ICFGNode *node)
virtual bool narrowCycleState(const AbstractState &prev, const AbstractState &cur, const ICFGCycleWTO *cycle)
virtual bool hasAbsValue(const ValVar *var, const ICFGNode *node) const
Side-effect-free existence check.
virtual AbstractState getFullCycleHeadState(const ICFGCycleWTO *cycle)
bool isBranchEdgeFeasible(const IntraCFGEdge *edge, AbstractState &as)
virtual bool widenCycleState(const AbstractState &prev, const AbstractState &cur, const ICFGCycleWTO *cycle)
virtual bool mergeStatesFromPredecessors(const ICFGNode *node)
SVFIR * svfir
Data and helpers reachable from SparseAbstractInterpretation.
virtual const AbstractValue & getAbsValue(const ValVar *var, const ICFGNode *node)
bool hasAbsState(const ICFGNode *node)
Map< const ICFGNode *, AbstractState > abstractTrace
per-node trace; owned here
virtual void storeValue(const ValVar *pointer, const AbstractValue &val, const ICFGNode *node)
const AddrToAbsValMap & getLocToVal() const
get loc2val map
void store(u32_t addr, const AbstractValue &val)
const Set< NodeID > & getFreedAddrs() const
virtual AbstractValue & load(u32_t addr)
static u32_t getVirtualMemAddress(u32_t idx)
The physical address starts with 0x7f...... + idx.
void addToFreedAddrs(NodeID addr)
void updateAddrStateOnly(const AbstractState &other)
Replace address-taken (ObjVar) state with other's, preserving ValVar state.
void join_with(const AbstractValue &other)
Map< const ICFGNode *, Map< NodeID, IntervalValue > > refinementTrace
void joinStates(AbstractState &dst, const AbstractState &src) override
bool isIntraEdgeBranchFeasible(const IntraCFGEdge *edge, const ICFGNode *src)
Return whether this intra edge is allowed by the current branch state.
bool mergeStatesFromPredecessors(const ICFGNode *node) override
bool isICFGPathFeasible(const ICFGNode *src, const ICFGNode *dst)
void storeValue(const ValVar *pointer, const AbstractValue &val, const ICFGNode *node) override
bool isIndirectSVFGEdgeFeasible(const IndirectSVFGEdge *edge, const VFGNode *dst)
std::unique_ptr< SVFGBuilder > svfgBuilder
void recordBranchRefinement(NodeID objId, const IntervalValue &narrowed, AbstractState &as, const ICFGNode *loadIcfg, const ICFGNode *succ) override
~FullSparseAbstractInterpretation() override
void buildSVFG()
Build the SVFG on top of the semi-sparse precompute.
void propagateAndApplyRefinement(const ICFGNode *node)
SVFG * svfg
View pointer into svfgBuilder's graph; non-null after buildSVFG().
void pullObjValueFlows(const ICFGNode *node)
NodeType * getGNode(NodeID id) const
Get a node.
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
const VFGNodeList & getVFGNodes() const
GlobalICFGNode * getGlobalICFGNode() const
NodeBS & getAllFieldsObjVars(const BaseObjVar *obj)
Get all fields of an object.
const SVFVar * getSVFVar(NodeID id) const
ObjVar/GepObjVar/BaseObjVar.
bool narrowCycleState(const AbstractState &prev, const AbstractState &cur, const ICFGCycleWTO *cycle) override
const AbstractValue & getAbsValue(const ValVar *var, const ICFGNode *node) override
AbstractState getFullCycleHeadState(const ICFGCycleWTO *cycle) override
void joinStates(AbstractState &dst, const AbstractState &src) override
bool widenCycleState(const AbstractState &prev, const AbstractState &cur, const ICFGCycleWTO *cycle) override
void updateAbsValue(const ValVar *var, const AbstractValue &val, const ICFGNode *node) override
bool hasAbsValue(const ValVar *var, const ICFGNode *node) const override
Side-effect-free existence check.
void updateAbsState(const ICFGNode *node, const AbstractState &state) override
const ICFGNode * getICFGNode(const ValVar *var) const
virtual const ICFGNode * getICFGNode() const
Return corresponding ICFG node.
llvm::IRBuilder IRBuilder