42 using namespace SVFUtil;
50 if (_client !=
nullptr)
67 runPointerAnalysis(pag, i);
95 _client->setQuery(buf);
101 assert(
false &&
"Please specify query options!");
104 _client->initialise(module);
119 _pta = std::make_unique<ContextDDA>(pag, _client);
124 _pta = std::make_unique<FlowDDA>(pag, _client);
128 outs() <<
"This pointer analysis has not been implemented yet.\n";
134 _client->collectWPANum(pag->
getModule());
141 _client->answerQueries(_pta.get());
147 if (_pta->printStat())
148 _client->performStat(_pta.get());
162 collectCxtInsenEdgeForRecur(pta,svfg,insensitveEdges);
164 collectCxtInsenEdgeForVFCycle(pta,svfg,svfgSCC,insensitveEdges);
188 assert(edge->
isRetVFGEdge() ==
false &&
"should not be an inter-procedural return edge" );
199 for (SVFG::SVFGNodeIDToNodeMapTy::const_iterator it = svfg->
begin(),eit = svfg->
end(); it != eit; ++it)
202 SVFGEdge::SVFGEdgeSetTy::const_iterator edgeIt = it->second->InEdgeBegin();
203 SVFGEdge::SVFGEdgeSetTy::const_iterator edgeEit = it->second->InEdgeEnd();
204 for (; edgeIt != edgeEit; ++edgeIt)
209 if(edgeInCallGraphSCC(pta,edge))
210 insensitveEdges.insert(edge);
224 for (SVFG::SVFGNodeIDToNodeMapTy::const_iterator it = svfg->
begin(),eit = svfg->
end(); it != eit; ++it)
227 SVFGEdge::SVFGEdgeSetTy::const_iterator edgeIt = it->second->InEdgeBegin();
228 SVFGEdge::SVFGEdgeSetTy::const_iterator edgeEit = it->second->InEdgeEnd();
229 for (; edgeIt != edgeEit; ++edgeIt)
234 if(this->edgeInSVFGSCC(svfgSCC,edge))
244 insensitvefunPairs.insert(std::make_pair(src,dst));
245 insensitvefunPairs.insert(std::make_pair(dst,src));
248 assert(edge->
isRetVFGEdge() ==
false &&
"should not be an inter-procedural return edge" );
254 for(SVFG::SVFGNodeIDToNodeMapTy::const_iterator it = svfg->
begin(),eit = svfg->
end(); it != eit; ++it)
256 SVFGEdge::SVFGEdgeSetTy::const_iterator edgeIt = it->second->InEdgeBegin();
257 SVFGEdge::SVFGEdgeSetTy::const_iterator edgeEit = it->second->InEdgeEnd();
258 for (; edgeIt != edgeEit; ++edgeIt)
271 if(insensitvefunPairs.find(std::make_pair(src,dst))!=insensitvefunPairs.end())
272 insensitveEdges.insert(edge);
273 else if(insensitvefunPairs.find(std::make_pair(dst,src))!=insensitvefunPairs.end())
274 insensitveEdges.insert(edge);
286 _pta->computeDDAPts(node1);
289 _pta->computeDDAPts(node2);
291 return _pta->alias(node1,node2);
310 _pta->computeDDAPts(node1->
getId());
314 _pta->computeDDAPts(node2->
getId());
316 return _pta->alias(V1,V2);
327 const OrderedNodeSet& candidates = _client->getCandidateQueries();
328 for (OrderedNodeSet::const_iterator it = candidates.begin(), eit = candidates.end(); it != eit; ++it)
330 const PointsTo& pts = _pta->getPts(*it);
331 _pta->dumpPts(*it,pts);
static void setMaxPathLen(u32_t max)
set max path limit
static void setMaxCxtLen(u32_t max)
set max context limit
virtual AliasResult alias(const SVFValue *V1, const SVFValue *V2)
Interface expose to users of our pointer analysis, given Value infos.
bool edgeInSVFGSCC(const SVFGSCC *svfgSCC, 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...
virtual void selectClient(SVFModule *module)
Select a client.
bool edgeInCallGraphSCC(PointerAnalysis *pta, 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 runPointerAnalysis(SVFIR *module, u32_t kind)
Create pointer analysis according to specified kind and analyze the module.
virtual void runOnModule(SVFIR *module)
We start from here.
OrderedSet< const SVFGEdge * > SVFGEdgeSet
void initCxtInsensitiveEdges(PointerAnalysis *pta, const SVFG *svfg, const SVFGSCC *svfgSCC, SVFGEdgeSet &insensitveEdges)
Context insensitive Edge for DDA.
void collectCxtInsenEdgeForVFCycle(PointerAnalysis *pta, const SVFG *svfg, const SVFGSCC *svfgSCC, SVFGEdgeSet &insensitveEdges)
void collectCxtInsenEdgeForRecur(PointerAnalysis *pta, const SVFG *svfg, SVFGEdgeSet &insensitveEdges)
void printQueryPTS()
Print queries' pts.
NodeType * getSrcNode() const
NodeID getSrcID() const
get methods of the components
NodeType * getDstNode() const
iterator begin()
Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
bool hasValueNode(const SVFValue *V)
NodeID getValueNode(const SVFValue *V)
static const Option< bool > InsenCycle
static const Option< std::string > UserInputQuery
static const Option< u32_t > MaxContextLen
static const Option< u32_t > MaxPathLen
static const Option< bool > WPANum
static const Option< bool > PrintCPts
static const Option< bool > PrintQueryPts
static const Option< bool > InsenRecur
static OptionMultiple< PointerAnalysis::PTATY > DDASelected
register this into alias analysis group
PTACallGraphNode * getCallGraphNode(NodeID id) const
Get call graph node.
PTATY
Pointer analysis type list.
@ Cxt_DDA
context sensitive DDA
@ FlowS_DDA
Flow sensitive DDA.
@ Default_PTA
default pta without any analysis
PTACallGraph * getCallGraph() const
Return call graph.
bool inSameCallGraphSCC(const SVFFunction *fun1, const SVFFunction *fun2)
Return TRUE if this edge is inside a PTACallGraph SCC, i.e., src node and dst node are in the same SC...
NodeID repNode(NodeID n) const
get the rep node if not found return itself
NodeID getId() const
Get ID.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
bool isValidTopLevelPtr(const SVFVar *node)
bool isRetVFGEdge() const
bool isCallVFGEdge() const
std::ostream & outs()
Overwrite llvm::outs()
OrderedSet< NodeID > OrderedNodeSet
std::set< Key, Compare, Allocator > OrderedSet