38using namespace SVFUtil;
57 &&
"FS::init: plain-mapping and cluster-fs are mutually exclusive.");
176 if (subNodes.
count() > 1)
255 else if (
LoadSVFGNode* load = SVFUtil::dyn_cast<LoadSVFGNode>(node))
261 else if (
StoreSVFGNode* store = SVFUtil::dyn_cast<StoreSVFGNode>(node))
286 else if (SVFUtil::isa<CmpVFGNode, BinaryOPVFGNode>(node) ||
287 SVFUtil::dyn_cast<UnaryOPVFGNode>(node))
292 assert(
false &&
"unexpected kind of SVFG nodes");
319 assert(
false &&
"new kind of svfg edge?");
363 assert(
fp &&
"expecting a formal param node");
379 assert(
ar &&
"expecting an actual return node");
434 if (SVFUtil::isa<StoreSVFGNode>(src))
508 if (
gepStmt->isVariantFieldGep())
663 if (
const StoreSVFGNode* store = SVFUtil::dyn_cast<StoreSVFGNode>(node))
765 if (SVFUtil::isa<PHISVFGNode>(
dstNode))
771 else if (SVFUtil::isa<FormalINSVFGNode, ActualOUTSVFGNode>(
dstNode))
779 const NodeBS&
pts = SVFUtil::cast<IndirectSVFGEdge>(
edge)->getPointsTo();
812 if (SVFUtil::isa<StoreSVFGNode>(src))
827 std::vector<std::pair<unsigned, unsigned>>
keys;
842 &&
"FS::cluster: plain mapping requires dense allocation strategy.");
858 for (std::pair<NodeID, NodeID>
locPA :
cmp)
862 for (std::pair<NodeID, NodeID>
locPB :
cmp)
877 assert(
"Not May/NoAlias?");
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
const PAGNode * getParam() const
Return parameter.
static AndersenWaveDiff * createAndersenWaveDiff(SVFIR *_pag)
Create an singleton instance directly instead of invoking llvm pass manager.
AliasResult alias(const SVFValue *V1, const SVFValue *V2) override
Interface expose to users of our pointer analysis, given Value infos.
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)
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
GEdgeSetTy::const_iterator const_iterator
bool isFieldInsensitive() const
Return true if its field limit is 0.
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="")
static std::vector< NodeID > getReverseNodeMapping(const std::vector< NodeID > &nodeMapping)
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
bool isFieldInsensitive(NodeID id) const
bool isLocalVarInRecursiveFun(NodeID id) const
Whether a local variable is in function recursions.
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)
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.
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
Set< const SVFFunction * > FunctionSet
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.
std::shared_ptr< std::vector< NodeID > > MappingPtr
static void setCurrentBestNodeMapping(MappingPtr newCurrentBestNodeMapping, MappingPtr newCurrentBestReverseNodeMapping)
static MappingPtr getCurrentBestNodeMapping()
NodeID getId() const
Get ID.
SVFG * buildPTROnlySVFG(BVDataPTAImpl *pta)
SVFGNode * getSVFGNode(NodeID id) const
Get a SVFG node.
void dump(const std::string &file, bool simple=false)
Dump graph into dot file.
virtual void connectCallerAndCallee(const CallICFGNode *cs, const SVFFunction *callee, SVFGEdgeSetTy &edges)
Connect SVFG nodes between caller and callee for indirect call site.
bool isConstantObj(NodeID id) const
const MemObj * getBaseObj(NodeID id) const
static double getClk(bool mark=false)
virtual bool isPointer() const
Whether it is a pointer.
NodeID getPAGDstNodeID() const
PAGNode * getPAGSrcNode() const
PAGNode * getPAGDstNode() const
NodeID getPAGSrcNodeID() const
NodeStack nodeStack
stack used for processing nodes.
virtual NodeStack & SCCDetect()
SCC detection.
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 hclustMethodToString(hclust_fast_methods method)
Returns a string representation of a hclust method.
void stopAnalysisLimitTimer(bool limitTimerSet)
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
LLVM_NODISCARD bool isa(const Y &Val)
bool startAnalysisLimitTimer(unsigned timeLimit)
std::ostream & outs()
Overwrite llvm::outs()
std::stack< NodeID > NodeStack
llvm::IRBuilder IRBuilder
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set