51 assert(!
Options::ClusterAnder() &&
"FlowSensitive::initialize: clustering auxiliary Andersen's unsupported.");
56 &&
"FS::init: plain-mapping and cluster-fs are mutually exclusive.");
84 double start =
stat->getClk(
true);
110 double end =
stat->getClk(
true);
122 if(!filename.empty())
125 if(!filename.empty())
160 if(!filename.empty())
172 svfg->dump(
"fs_solved",
true);
182 if (subNodes.
count() > 1)
212 double start =
stat->getClk();
214 double end =
stat->getClk();
236 double start =
stat->getClk();
237 bool changed =
false;
293 assert(
false &&
"unexpected kind of SVFG nodes");
296 double end =
stat->getClk();
312 double start =
stat->getClk();
313 bool changed =
false;
320 assert(
false &&
"new kind of svfg edge?");
322 double end =
stat->getClk();
332 double start =
stat->getClk();
333 bool changed =
false;
352 double end =
stat->getClk();
364 assert(fp &&
"expecting a formal param node");
368 bool changed =
unionPts(pagDst, srcCPts);
380 assert(ar &&
"expecting an actual return node");
384 bool changed =
unionPts(pagDst, srcCPts);
394 double start =
stat->getClk();
399 bool changed =
false;
416 fieldIt != fieldEit; ++fieldIt)
424 double end =
stat->getClk();
434 bool changed =
false;
453 double start =
stat->getClk();
460 double end =
stat->getClk();
470 double start =
stat->getClk();
472 double end =
stat->getClk();
482 double start =
stat->getClk();
483 bool changed =
false;
487 NodeID src = it->second->getId();
493 double end =
stat->getClk();
503 double start =
stat->getClk();
504 bool changed =
false;
534 tmpDstPts.
set(fieldSrcPtdNode);
541 double end =
stat->getClk();
555 double start =
stat->getClk();
556 bool changed =
false;
569 if (
pag->isConstantObj(ptd))
581 fieldIt != fieldEit; ++fieldIt)
589 double end =
stat->getClk();
614 double start =
stat->getClk();
615 bool changed =
false;
624 if (
pag->isConstantObj(ptd))
632 double end =
stat->getClk();
635 double updateStart =
stat->getClk();
652 double updateEnd =
stat->getClk();
667 if (dstCPSet.
count() == 1)
676 assert(
pag->getBaseObject(singleton)->isFieldInsensitive() ==
pag->getBaseObject(singleton)->isFieldInsensitive());
677 if (
pag->getBaseObject(singleton)->isFieldInsensitive() ==
false
693 double start =
stat->getClk();
700 for (
typename CallEdgeMap::value_type &csfs : newEdges)
706 typename CallEdgeMap::const_iterator andersFunctionSetIt
707 = andersCallEdgeMap.find(potentialCallSite);
708 if (andersFunctionSetIt == andersCallEdgeMap.end())
710 potentialFunctionSet.clear();
713 const FunctionSet &andersFunctionSet = andersFunctionSetIt->second;
714 for (FunctionSet::iterator potentialFunctionIt = potentialFunctionSet.begin();
715 potentialFunctionIt != potentialFunctionSet.end(); )
717 const FunObjVar *potentialFunction = *potentialFunctionIt;
718 if (andersFunctionSet.find(potentialFunction) == andersFunctionSet.end())
721 potentialFunctionIt = potentialFunctionSet.erase(potentialFunctionIt);
726 ++potentialFunctionIt;
736 double end =
stat->getClk();
738 return (!newEdges.empty());
746 CallEdgeMap::const_iterator iter = newEdges.begin();
747 CallEdgeMap::const_iterator eiter = newEdges.end();
748 for (; iter != eiter; iter++)
752 for (FunctionSet::const_iterator func_iter = functions.begin(); func_iter != functions.end(); func_iter++)
755 svfg->connectCallerAndCallee(cs, func, edges);
768 SVFGNode* dstNode = edge->getDstNode();
779 bool changed =
false;
781 SVFGNode* srcNode = edge->getSrcNode();
796 fieldIt != fieldEit; ++fieldIt)
831 std::vector<std::pair<unsigned, unsigned>> keys;
832 for (
const auto& pair : *
pag)
833 keys.emplace_back(pair.first, 1);
836 std::make_shared<std::vector<NodeID>>(
848 &&
"FS::cluster: plain mapping requires dense allocation strategy.");
853 for (
NodeID i = 0; i < plainMapping->size(); ++i)
855 plainMapping->at(i) = i;
856 reversePlainMapping->at(i) = i;
864 for (std::pair<NodeID, NodeID> locPA : cmp)
868 for (std::pair<NodeID, NodeID> locPB : cmp)
870 if (locPB == locPA)
continue;
883 assert(
"Not May/NoAlias?");
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
APOffset getConstantStructFldIdx() const
Get methods.
const ValVar * getParam() const
Return parameter.
const ValVar * getRev() const
Receive parameter at callsite.
static AndersenWaveDiff * createAndersenWaveDiff(SVFIR *_pag)
Create an singleton instance directly instead of invoking llvm pass manager.
virtual void writeToFile(const std::string &filename)
Interface for analysis result storage on filesystem.
virtual bool readFromFile(const std::string &filename)
virtual void writeObjVarToFile(const std::string &filename)
AliasResult alias(const SVFVar *V1, const SVFVar *V2) override
Interface expose to users of our pointer analysis, given Value infos.
void finalize() override
Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.
virtual void onTheFlyCallGraphSolve(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
On the fly call graph construction.
PersistentPointsToCache< PointsTo > & getPtCache()
PTData< NodeID, NodeSet, NodeID, PointsTo > PTDataTy
const PointsTo & getPts(NodeID id) override
virtual bool unionPts(NodeID id, const PointsTo &target)
PTDataTy * getPTDataTy() const
Get points-to data structure.
virtual bool addPts(NodeID id, NodeID ptd)
void processNode(NodeID nodeId) override
Handle various constraints.
u32_t numOfProcessedLoad
Number of processed Phi node.
virtual void solveConstraints()
virtual bool unionPtsFromIn(const SVFGNode *stmt, NodeID srcVar, NodeID dstVar)
virtual void updateConnectedNodes(const SVFGEdgeSetTy &edges)
Update nodes connected during updating call graph.
u32_t numOfProcessedCopy
Number of processed Addr node.
virtual void countAliases(Set< std::pair< NodeID, NodeID > > cmp, unsigned *mayAliases, unsigned *noAliases)
Fills may/noAliases for the location/pointer pairs in cmp.
double gepTime
time of handling gep edges
static std::unique_ptr< FlowSensitive > fspta
double indirectPropaTime
time of points-to propagation of top-level pointers
virtual bool propagateFromAPToFP(const ActualParmSVFGNode *ap, const SVFGNode *dst)
double addrTime
time of handling address edges
virtual bool propagateFromFRToAR(const FormalRetSVFGNode *fr, const SVFGNode *dst)
virtual bool propDFInToIn(const SVFGNode *srcStmt, NodeID srcVar, const SVFGNode *dstStmt, NodeID dstVar)
NodeStack & SCCDetect() override
SCC detection.
double solveTime
time of solve.
bool isStrongUpdate(const SVFGNode *node, NodeID &singleton)
Return TRUE if this is a strong update STORE statement.
virtual void readPtsFromFile(const std::string &filename)
virtual bool unionPtsFromTop(const SVFGNode *stmt, NodeID srcVar, NodeID dstVar)
virtual void plainMap(void) const
Sets the global best mapping as a plain mapping, i.e. n -> n.
virtual bool propDFOutToIn(const SVFGNode *srcStmt, NodeID srcVar, const SVFGNode *dstStmt, NodeID dstVar)
u32_t numOfProcessedStore
Number of processed Load node.
SVFG::SVFGEdgeSetTy SVFGEdgeSetTy
void analyze() override
Flow sensitive analysis.
double storeTime
time of store edges
virtual bool updateInFromIn(const SVFGNode *srcStmt, NodeID srcVar, const SVFGNode *dstStmt, NodeID dstVar)
double copyTime
time of handling copy edges
bool propFromSrcToDst(SVFGEdge *edge) override
Propagation.
u32_t numOfProcessedGep
Number of processed Copy node.
friend class FlowSensitiveStat
virtual void cluster(void)
virtual bool strongUpdateOutFromIn(const SVFGNode *node, NodeID singleton)
Handle strong updates.
void finalize() override
Finalize analysis.
void clearAllDFOutVarFlag(const SVFGNode *stmt)
bool processSVFGNode(SVFGNode *node)
virtual bool processLoad(const LoadSVFGNode *load)
bool propVarPtsAfterCGUpdated(NodeID var, const SVFGNode *src, const SVFGNode *dst)
virtual bool processPhi(const PHISVFGNode *phi)
virtual bool processStore(const StoreSVFGNode *store)
u32_t maxSCCSize
Number of processed mssa node.
virtual bool processCopy(const CopySVFGNode *copy)
double loadTime
time of load edges
bool updateCallGraph(const CallSiteToFunPtrMap &callsites) override
Update call graph.
virtual bool weakUpdateOutFromIn(const SVFGNode *node)
Handle weak updates.
virtual bool processAddr(const AddrSVFGNode *addr)
u32_t numOfProcessedPhi
Number of processed Gep node.
double propagationTime
time of points-to propagation.
virtual bool propAlongDirectEdge(const DirectSVFGEdge *edge)
Propagate points-to information along a DIRECT SVFG edge.
void initialize() override
Initialize analysis.
void connectCallerAndCallee(const CallEdgeMap &newEdges, SVFGEdgeSetTy &edges)
Connect nodes in SVFG.
std::vector< std::pair< hclust_fast_methods, std::vector< NodeID > > > candidateMappings
Save candidate mappings for evaluation's sake.
virtual bool processGep(const GepSVFGNode *edge)
double directPropaTime
time of points-to propagation of address-taken objects
double processTime
time of processNode.
u32_t numOfProcessedAddr
Statistics.
virtual bool propVarPtsFromSrcToDst(NodeID var, const SVFGNode *src, const SVFGNode *dst)
Propagate points-to information of a certain variable from src to dst.
virtual bool propAlongIndirectEdge(const IndirectSVFGEdge *edge)
Propagate points-to information along an INDIRECT SVFG edge.
double phiTime
time of phi nodes.
double sccTime
time of SCC detection.
double updateTime
time of strong/weak updates.
virtual bool updateInFromOut(const SVFGNode *srcStmt, NodeID srcVar, const SVFGNode *dstStmt, NodeID dstVar)
u32_t numOfProcessedMSSANode
Number of processed formal ret node.
virtual void solveAndwritePtsToFile(const std::string &filename)
double updateCallGraphTime
time of updating call graph
NodeType * getSrcNode() const
NodeType * getDstNode() const
bool isVariantFieldGep() const
Gep statement with a variant field index (pointer arithmetic) for struct field access.
const AccessPath & getAccessPath() const
const NodeBS & getPointsTo() const
const ValVar * getDstNode() const
static std::vector< NodeID > getReverseNodeMapping(const std::vector< NodeID > &nodeMapping)
static std::vector< NodeID > cluster(BVDataPTAImpl *pta, const std::vector< std::pair< NodeID, unsigned > > keys, std::vector< std::pair< hclust_fast_methods, std::vector< NodeID > > > &candidates, std::string evalSubtitle="", bool printStat=true)
static void printStats(std::string title, Map< std::string, std::string > &stats)
static void evaluate(const std::vector< NodeID > &nodeMap, const Map< PointsTo, unsigned > pointsToSets, Map< std::string, std::string > &stats, bool accountForOcc)
Fills in *NumWords statistics in stats..
static NodeIDAllocator * get(void)
Return (singleton) allocator.
NodeID getNumObjects(void) const
Returns the total number of memory objects.
static const Option< bool > PlainMappingFs
Use an explicitly plain mapping with flow-sensitive (not null).
static const OptionMap< SVF::NodeIDAllocator::Strategy > NodeAllocStrat
static const Option< std::string > ReadAnder
static const Option< bool > ClusterAnder
Whether to stage Andersen's with Steensgaard and cluster based on that data.
static const Option< u32_t > FsTimeLimit
Time limit for the main phase (i.e., the actual solving) of FS analyses.
static const Option< bool > ClusterFs
Whether to cluster FS or VFS with the auxiliary Andersen's.
static const Option< std::string > WriteAnder
static const Option< bool > DumpVFG
OPVers::const_iterator opVerBegin() const
OPVers::const_iterator opVerEnd() const
const ValVar * getRes() const
virtual Map< DataSet, unsigned > getAllPts(bool liveOnly) const =0
bool isFieldInsensitive(NodeID id) const
bool isLocalVarInRecursiveFun(NodeID id) const
Whether a local variable is in function recursions.
bool print_stat
User input flags.
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
virtual void initialize()
Initialization of a pointer analysis, including building symbol table and SVFIR etc.
virtual bool isBlkObjOrConstantObj(NodeID ptd) const
PTAStat * stat
Statistics.
NodeID getFIObjVar(NodeID id)
Set< const FunObjVar * > FunctionSet
const CallSiteToFunPtrMap & getIndirectCallsites() const
Return all indirect callsites.
bool isArrayMemObj(NodeID id) const
NodeID getGepObjVar(NodeID id, const APOffset &ap)
void dumpStat()
Dump the statistics.
void setObjFieldInsensitive(NodeID id)
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
CallGraphSCC * callGraphSCC
SCC for PTACallGraph.
bool isHeapMemObj(NodeID id) const
Whether this object is heap or array.
virtual const NodeBS & getAllFieldsObjVars(NodeID id)
u32_t OnTheFlyIterBudgetForStat
Flag for iteration budget for on-the-fly statistics.
bool empty() const
Returns true if set is empty.
const_iterator end() const
std::shared_ptr< std::vector< NodeID > > MappingPtr
static void setCurrentBestNodeMapping(MappingPtr newCurrentBestNodeMapping, MappingPtr newCurrentBestReverseNodeMapping)
u32_t count() const
Returns number of elements.
void set(u32_t n)
Inserts n in the set.
const_iterator begin() const
static MappingPtr getCurrentBestNodeMapping()
const NodeBS & subNodes(NodeID n) const
get all subnodes in one scc, if size is empty insert itself into the set
NodeID getId() const
Get ID.
virtual bool isPointer() const
Check if this variable represents a pointer.
SparseBitVectorIterator iterator
NodeID getSrcNodeID() const
const SVFStmt * getSVFStmt() const
NodeID getDstNodeID() const
const ValVar * getSrcNode() const
VFGEdge::VFGEdgeSetTy::const_iterator const_iterator
virtual NodeStack & SCCDetect()
SCC * getSCCDetector() const
Get SCC detector.
virtual void pushIntoWorklist(NodeID id)
virtual void propagate(GNODE *v)
virtual void initWorklist()
void setGraph(GraphType g)
virtual NodeStack & SCCDetect()
SCC detection.
u32_t numOfIteration
num of iterations during constraint solving
virtual void solveWorklist()
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > cast(const Y &Val)
LLVM_NODISCARD bool isa(const Y &Val)
void stopAnalysisLimitTimer(void)
Stops analysis timer.
void startAnalysisLimitTimer(unsigned timeLimit)
Starts analysis timer. timeLimit must be non-0. Timer must not be already set.
std::ostream & outs()
Overwrite llvm::outs().
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
ActualParmVFGNode ActualParmSVFGNode
std::stack< NodeID > NodeStack
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
StoreVFGNode StoreSVFGNode
ActualRetVFGNode ActualRetSVFGNode
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
FormalParmVFGNode FormalParmSVFGNode
FormalRetVFGNode FormalRetSVFGNode
NullPtrVFGNode NullPtrSVFGNode