39 using namespace SVFUtil;
44 MemSSA* mssa = svfg->getMSSA();
53 rmDerefDirSVFGEdges(pta);
55 assert(saberCondAllocator &&
"saber condition allocator not set yet!");
56 rmIncomingEdgeForSUStore(pta);
77 if (SVFUtil::isa<DummyValVar, DummyObjVar>(pagNode))
80 if(
GepObjVar* gepobj = SVFUtil::dyn_cast<GepObjVar>(pagNode))
82 if(SVFUtil::isa<DummyObjVar>(pag->
getGNode(gepobj->getBaseNode())))
87 if(SVFUtil::isa<SVFGlobalValue>(val))
88 worklist.push_back(it->first);
93 while(!worklist.empty())
95 NodeID id = worklist.back();
101 globs |= CollectPtsChain(pta,*it,cachedPtsMap);
127 NodeToPTSSMap::iterator it = cachedPtsMap.find(baseId);
128 if(it!=cachedPtsMap.end())
134 PointsTo& pts = cachedPtsMap[baseId];
140 ValVar* valVar = SVFUtil::dyn_cast<ValVar>(pag->
getGNode(baseId));
154 while(!worklist.
empty())
160 pts |= CollectPtsChain(pta,*it,cachedPtsMap);
183 for(
SVFG::iterator it = svfg->begin(), eit = svfg->end(); it!=eit; ++it)
187 if(
const StmtSVFGNode* stmtNode = SVFUtil::dyn_cast<StmtSVFGNode>(node))
190 if(SVFUtil::isa<StoreSVFGNode>(stmtNode))
192 const SVFGNode* def = svfg->getDefSVFGNode(stmtNode->getPAGDstNode());
194 svfg->removeSVFGEdge(edge);
198 if(accessGlobal(pta,stmtNode->getPAGDstNode()))
200 globSVFGNodes.insert(stmtNode);
203 else if(SVFUtil::isa<LoadSVFGNode>(stmtNode))
205 const SVFGNode* def = svfg->getDefSVFGNode(stmtNode->getPAGSrcNode());
207 svfg->removeSVFGEdge(edge);
211 if(accessGlobal(pta,stmtNode->getPAGSrcNode()))
213 globSVFGNodes.insert(stmtNode);
227 if (
const StoreSVFGNode* store = SVFUtil::dyn_cast<StoreSVFGNode>(node))
230 if (dstCPSet.
count() == 1)
261 for(
SVFG::iterator it = svfg->begin(), eit = svfg->end(); it!=eit; ++it)
265 if(
const StoreSVFGNode* stmtNode = SVFUtil::dyn_cast<StoreSVFGNode>(node))
267 if(SVFUtil::isa<StoreStmt>(stmtNode->getPAGEdge()))
270 if(isStrongUpdate(node, singleton, pta))
275 if ((*it2)->isIndirectVFGEdge())
277 toRemove.insert(*it2);
282 if (isa<StoreSVFGNode>(edge->getSrcNode()))
283 saberCondAllocator->getRemovedSUVFEdges()[edge->getSrcNode()].insert(edge->getDstNode());
284 svfg->removeSVFGEdge(edge);
302 for (PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
303 ecit = callees.end(); cit != ecit; cit++)
311 for(SVFIR::SVFVarList::const_iterator ait = arglist.begin(), aeit = arglist.end(); ait!=aeit; ++ait)
316 addActualParmVFGNode(pagNode, it->first);
317 svfg->addIntraDirectVFEdge(svfg->getDefSVFGNode(pagNode)->getId(), svfg->getActualParmVFGNode(pagNode, it->first)->getId());
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
const PointsTo & getPts(NodeID id) override
bool push(const Data &data)
iterator begin()
Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
IDToNodeMapTy::iterator iterator
Node Iterators.
bool isFieldInsensitive() const
Return true if its field limit is 0.
BVDataPTAImpl * getPTA() const
Return PTA.
static const Option< bool > CollectExtRetGlobals
void getCallees(const CallICFGNode *cs, FunctionSet &callees)
Get all callees for a callsite.
Set< const SVFFunction * > FunctionSet
bool isLocalVarInRecursiveFun(NodeID id) const
Whether a local variable is in function recursions.
bool printStat()
Whether print statistics.
PTACallGraph * getCallGraph() const
Return call graph.
bool isArrayMemObj(NodeID id) const
bool isHeapMemObj(NodeID id) const
Whether this object is heap or array.
bool isFIObjNode(NodeID id) const
const_iterator end() const
u32_t count() const
Returns number of elements.
void set(u32_t n)
Inserts n in the set.
const_iterator begin() const
bool intersects(const PointsTo &rhs) const
Returns true if this set and rhs share any elements.
NodeID getId() const
Get ID.
CSToArgsListMap & getCallSiteArgsMap()
Get callsite argument list.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
NodeBS getFieldsAfterCollapse(NodeID id)
std::vector< const SVFVar * > SVFVarList
NodeID getBaseObjVar(NodeID id) const
Base and Offset methods for Value and Object node.
const MemObj * getBaseObj(NodeID id) const
virtual bool isPointer() const
Whether it is a pointer.
const SVFValue * getValue() const
Get/has methods of the components.
static SaberCheckerAPI * getCheckerAPI()
Return a static reference.
bool isStrongUpdate(const SVFGNode *node, NodeID &singleton, BVDataPTAImpl *pta)
Return TRUE if this is a strong update STORE statement.
void collectGlobals(BVDataPTAImpl *pta)
PointsTo & CollectPtsChain(BVDataPTAImpl *pta, NodeID id, NodeToPTSSMap &cachedPtsMap)
Collect objects along points-to chains.
bool accessGlobal(BVDataPTAImpl *pta, const PAGNode *pagNode)
Whether points-to of a PAGNode points-to global variable.
Map< NodeID, PointsTo > NodeToPTSSMap
virtual void buildSVFG()
Re-write create SVFG method.
virtual void AddExtActualParmSVFGNodes(PTACallGraph *callgraph)
Add actual parameter SVFGNode for 1st argument of a deallocation like external function.
void rmDerefDirSVFGEdges(BVDataPTAImpl *pta)
virtual void rmIncomingEdgeForSUStore(BVDataPTAImpl *pta)
VFGEdge::VFGEdgeSetTy::const_iterator const_iterator
const SVFBaseNode * getGNode() const
bool isExtCall(const SVFFunction *fun)
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
std::ostream & outs()
Overwrite llvm::outs()
std::vector< NodeID > NodeVector
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set