30#ifndef VALUEFLOWDDA_H_
31#define VALUEFLOWDDA_H_
46template<
class CVar,
class CPtSet,
class DPIm>
131 for(
typename CPtSet::iterator
it = cpts.begin(),
eit = cpts.end();
it!=
eit; ++
it)
176 if(SVFUtil::isa<AddrSVFGNode>(node))
186 else if(SVFUtil::isa<GepSVFGNode>(node))
192 else if(
const LoadSVFGNode* load = SVFUtil::dyn_cast<LoadSVFGNode>(node))
194 if(load->getPAGDstNode()->isPointer() ==
false)
204 else if(
const StoreSVFGNode* store = SVFUtil::dyn_cast<StoreSVFGNode>(node))
206 if(store->getPAGSrcNode()->isPointer() ==
false)
246 else if(SVFUtil::isa<MRSVFGNode>(node))
251 assert(
false &&
"unexpected kind of SVFG nodes");
290 if(!
indirectCall && SVFUtil::isa<IndirectSVFGEdge>(
edge) && !SVFUtil::isa<LoadSVFGNode>(
edge->getDstNode()))
292 if(
dstDpm.getCurNodeID() ==
dpm.getCurNodeID())
441 if(SVFUtil::isa<IndirectSVFGEdge>(
edge))
459 typename CPtSet::iterator
it =
dstCPSet.begin();
460 const CVar&
var = *
it;
478 if(SVFUtil::isa<StackObjVar>(
baseObj))
587 return !SVFUtil::isa<StoreSVFGNode, MRSVFGNode>(
stmt);
595 if(SVFUtil::isa<StoreSVFGNode>(
loc))
598 if(SVFUtil::isa<LoadSVFGNode>(
loc))
643 return pVar && SVFUtil::isa<HeapObjVar, DummyObjVar>(
pVar);
649 assert(mem &&
"memory object is null??");
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
static AndersenWaveDiff * createAndersenWaveDiff(SVFIR *_pag)
Create an singleton instance directly instead of invoking llvm pass manager.
u32_t _NumOfStrongUpdates
u32_t _NumOfInfeasiblePath
double _TotalTimeOfBKCondition
double _AnaTimeCyclePerQuery
NodeBS _StrongUpdateStores
void removeDpmFromLoc(const DPIm &dpm)
bool edgeInSVFGSCC(const SVFGEdge *edge)
Return TRUE if this edge is inside a SVFG SCC, i.e., src node and dst node are in the same SCC on the...
void backtraceAlongIndirectVF(CPtSet &pts, const DPIm &oldDpm)
Backward traverse along indirect value flows.
OrderedSet< DPIm > DPTItemSet
virtual const CPtSet & getCachedADPointsTo(const DPIm &dpm)
bool isOutOfBudgetDpm(const DPIm &dpm) const
SVFIR::CallSiteSet CallSiteSet
SVFGBuilder svfgBuilder
SVFG Builder.
NodeID getSVFGSCCRepNode(NodeID id)
Get SCC rep node of a SVFG node.
void addLoadDpmAndCVar(const DPIm &dpm, const DPIm &loadDpm, const CVar &loadVar)
LoadDpm for must-alias analysis.
const CVar & getLoadCVar(const DPIm &dpm) const
virtual bool isLocalCVarInRecursion(const CVar &var) const
Whether a local variable is in function recursions.
virtual ~DDAVFSolver()
Destructor.
virtual void updateCachedPointsTo(const DPIm &dpm, const CPtSet &pts)
DPImToCPtSetMap dpmToADCPtSetMap
points-to caching map for address-taken vars
OrderedMap< DPIm, DPIm > DPMToDPMMap
DPImToCPtSetMap dpmToTLCPtSetMap
points-to caching map for top-level vars
virtual bool isMustAlias(const DPIm &, const DPIm &)
whether load and store are aliased
bool isFieldInsenCondMemObj(const CVar &var) const
virtual CPtSet getConservativeCPts(const DPIm &dpm)=0
Get conservative points-to results when the query is out of budget.
virtual NodeID getPtrNodeID(const CVar &var) const =0
Methods to be implemented in child class.
bool testOutOfBudget(const DPIm &dpm)
void addLoadDpm(const DPIm &dpm, const DPIm &loadDpm)
Note that simply use "dpmToloadDpmMap[dpm]=loadDpm", requires DPIm have a default constructor.
AndersenWaveDiff * getAndersenAnalysis() const
Return Andersen's analysis.
CallGraphSCC * _callGraphSCC
SCC for PTACallGraph.
SCCDetection< SVFG * > SVFGSCC
const LocToDPMVecMap & getLocToDPMVecMap() const
Map a SVFGNode to its dpms for handling value-flow cycles.
SVFGSCC * _svfgSCC
SCC for SVFG.
virtual void addDDAPts(CPtSet &pts, const CVar &var)
Add pts.
virtual bool handleBKCondition(DPIm &, const SVFGEdge *)
Handle condition for context or path analysis (backward analysis)
virtual void updateCallGraphAndSVFG(const DPIm &, const CallICFGNode *, SVFGEdgeSet &)
Update call graph.
DPTItemSet backwardVisited
visited map during backward traversing
virtual bool isHeapCondMemObj(const CVar &var, const StoreSVFGNode *)
Check heap and array object.
SVFGEdge::SVFGEdgeSetTy SVFGEdgeSet
DPMToCVarMap loadToPTCVarMap
map a load dpm to its cvar pointed by its pointer operand
void markbkVisited(const DPIm &dpm)
Visited flags to avoid cycles.
void addLoadCVar(const DPIm &dpm, const CVar &loadVar)
bool isOutOfBudgetQuery() const
void backtraceAlongDirectVF(CPtSet &pts, const DPIm &oldDpm)
Backward traverse along direct value flows.
bool isTopLevelPtrStmt(const SVFGNode *stmt)
Whether this is a top-level pointer statement.
void rmSUStat(const DPIm &dpm, const SVFGNode *node)
remove strong updates num if the dpm goes to weak updates branch
DDAVFSolver()
Constructor.
NodeBS & getCandidateQueries()
Return candidate pointers for DDA.
OrderedMap< DPIm, CPtSet > DPImToCPtSetMap
void reCompute(const DPIm &dpm)
recompute points-to for value-flow cycles and indirect calls
void handleOutOfBudgetDpm(const DPIm &dpm)
handle out-of-budget queries
virtual bool isStrongUpdate(const CPtSet &dstCPSet, const StoreSVFGNode *store)
Return TRUE if this is a strong update STORE statement.
virtual bool unionDDAPts(CPtSet &pts, const CPtSet &targetPts)
Union pts.
virtual void handleSingleStatement(const DPIm &dpm, CPtSet &pts)
Handle single statement.
bool isbkVisited(const DPIm &dpm)
bool isArrayCondMemObj(const CVar &var) const
DPMToDPMMap dpmToloadDpmMap
dpms at loads for may/must-alias analysis with stores
AndersenWaveDiff * _ander
Andersen's analysis.
void dumpCPtSet(const CPtSet &cpts) const
LocToDPMVecMap locToDpmSetMap
map location to its dpms
void clearbkVisited(const DPIm &dpm)
const SVFGNode * getDefSVFGNode(const PAGNode *pagNode) const
GetDefinition SVFG.
OrderedMap< NodeID, DPTItemSet > LocToDPMVecMap
DPTItemSet outOfBudgetDpms
out of budget dpm set
virtual CPtSet processGepPts(const GepSVFGNode *gep, const CPtSet &srcPts)=0
ProcessGep node to generate field object nodes of a struct.
void OOBResetVisited()
Reset visited map if the current query is out-of-budget.
void SVFGSCCDetection()
SVFG SCC detection.
virtual const CPtSet & findPT(const DPIm &dpm)
Compute points-to.
void setCallGraphSCC(CallGraphSCC *scc)
Set callgraphSCC.
PTACallGraph * _callGraph
PTACallGraph.
SVFG * getSVFG() const
Return SVFG.
const DPTItemSet & getDpmSetAtLoc(const SVFGNode *loc)
PTACallGraphEdge::CallInstSet CallInstSet
virtual DPIm getDPImWithOldCond(const DPIm &oldDpm, const CVar &var, const SVFGNode *loc)
Return dpm with old context and path conditions.
OrderedMap< const SVFGNode *, DPTItemSet > StoreToPMSetMap
void startNewPTCompFromLoadSrc(CPtSet &pts, const DPIm &oldDpm)
void reComputeForEdges(const DPIm &dpm, const SVFGEdgeSet &edgeSet, bool indirectCall=false)
Traverse along out edges to find all nodes which may be affected by locDPM.
virtual bool propagateViaObj(const CVar &storeObj, const CVar &loadObj)
If the points-to contain the object obj, we could move forward along indirect value-flow edge.
virtual void handleAddr(CPtSet &pts, const DPIm &dpm, const AddrSVFGNode *addr)=0
Handle AddrSVFGNode to add proper points-to.
virtual DPIm getDPIm(const CVar &var, const SVFGNode *loc) const
Given CVar and location (SVFGNode) return a new DPItem.
void backtraceToStoreSrc(CPtSet &pts, const DPIm &oldDpm)
bool isSVFGNodeInCycle(const SVFGNode *node)
Return whether this SVFGNode is in cycle.
SVFGSCC * getSVFGSCC() const
Return SVFGSCC.
NodeBS candidateQueries
candidate pointers;
void addOutOfBudgetDpm(const DPIm &dpm)
DDAStat * ddaStat
DDA stat.
virtual bool unionDDAPts(DPIm dpm, const CPtSet &targetPts)
Union pts.
void addSUStat(const DPIm &dpm, const SVFGNode *node)
stat strong updates num
virtual const CPtSet & getCachedPointsTo(const DPIm &dpm)
Points-to Caching for top-level pointers and address-taken objects.
OrderedSet< const SVFGEdge * > ConstSVFGEdgeSet
OrderedMap< DPIm, CVar > DPMToCVarMap
virtual void buildSVFG(SVFIR *pag)
Build SVFG.
const DPIm & getLoadDpm(const DPIm &dpm) const
virtual const CPtSet & getCachedTLPointsTo(const DPIm &dpm)
StoreToPMSetMap storeToDPMs
map store to set of DPM which have been stong updated there
virtual void backwardPropDpm(CPtSet &pts, NodeID ptr, const DPIm &oldDpm, const SVFGEdge *edge)
dpm transit during backward tracing
SCCDetection< PTACallGraph * > CallGraphSCC
void addDpmToLoc(const DPIm &dpm)
DDAStat * setDDAStat(DDAStat *s)
Set DDAStat.
void setCallGraph(PTACallGraph *cg)
Set callgraph.
void resolveFunPtr(const DPIm &dpm)
resolve function pointer
bool outOfBudgetQuery
Whether the current query is out of step limits.
virtual void resetQuery()
Reset visited map for next points-to query.
void startNewPTCompFromStoreDst(CPtSet &pts, const DPIm &oldDpm)
NodeType * getGNode(NodeID id) const
Get a node.
const GEdgeSetTy & getInEdges() const
bool isFieldInsensitive() const
Return true if its field limit is 0.
Set< const CallICFGNode * > CallInstSet
void getIndCallSitesInvokingCallee(const SVFFunction *callee, PTACallGraphEdge::CallInstSet &csSet)
PTACallGraphNode * getCallGraphNode(NodeID id) const
Get call graph node.
PTACallGraph * getCallGraph() const
Return call graph.
NodeID getId() const
Get ID.
SVFG * buildPTROnlySVFG(BVDataPTAImpl *pta)
const SVFGNode * getDefSVFGNode(const PAGNode *pagNode) const
Given a pagNode, return its definition site.
NodeID getFunPtr(const CallICFGNode *cs) const
Set< const CallICFGNode * > CallSiteSet
bool isIndirectCallSites(const CallICFGNode *cs) const
bool isConstantObj(NodeID id) const
const BaseObjVar * getBaseObject(NodeID id) const
const MemObj * getBaseObj(NodeID id) const
bool isFunPtr(NodeID id) const
const MemObj * getObject(NodeID id) const
const CallSiteSet & getIndCallSites(NodeID funPtr) const
static double getClk(bool mark=false)
virtual const SVFFunction * getFunction() const
NodeID getPAGDstNodeID() const
PAGNode * getPAGSrcNode() const
PAGNode * getPAGDstNode() const
NodeID getPAGSrcNodeID() const
VFGEdgeSetTy SVFGEdgeSetTy
VFGEdge::VFGEdgeSetTy::const_iterator const_iterator
SVFIR * getPAG() const
Return SVFIR.
VFGEdge * getIntraVFGEdge(const VFGNode *src, const VFGNode *dst, VFGEdge::VFGEdgeK kind)
Get a SVFG edge according to src and dst.
LLVM_NODISCARD bool isa(const Y &Val)
std::ostream & outs()
Overwrite llvm::outs()
llvm::IRBuilder IRBuilder
void dump(const SparseBitVector< ElementSize > &LHS, std::ostream &out)