34#ifndef MEMORYREGION_H_
35#define MEMORYREGION_H_
const SVFFunction * getCaller() const
Return callsite.
virtual void getMRsForCallSiteRef(MRSet &aliasMRs, const NodeBS &cpts, const SVFFunction *)
Get memory regions for call site ref according to cpts.
FunToPointsTosMap funToPointsToMap
Map a function to all of its conditional points-to sets.
MRSet & getStoreMRSet(const StoreStmt *store)
Map< const SVFFunction *, MRSet > FunToMRsMap
Map a function to its region set.
LoadsToMRsMap loadsToMRsMap
Map a load SVFIR Edge to its memory regions sets in order for inserting mus in Memory SSA.
NodeToPTSSMap cachedPtsChainMap
Map a pointer to its cached points-to chain;.
MRSet & getCallSiteRefMRSet(const CallICFGNode *cs)
bool hasModSideEffectOfCallSite(const CallICFGNode *cs)
Has indirect mods of a callsite.
const SVFFunction * getFunction(const PAGEdge *pagEdge) const
Get the function which SVFIR Edge located.
bool hasCPtsList(const SVFFunction *fun) const
virtual void collectModRefForLoadStore()
Generate regions for loads/stores.
CallSiteToPointsToMap csToCallSiteRetPtsMap
Map a callsite to all its object might return from its callees.
StoresToMRsMap storesToMRsMap
Map a store SVFIR Edge to its memory regions sets in order for inserting chis in Memory SSA.
Map< const CallICFGNode *, NodeBS > CallSiteToPointsToMap
Map< const LoadStmt *, MRSet > LoadsToMRsMap
SVFStmtList & getPAGEdgesFromInst(const ICFGNode *node)
Given an instruction, get all its the PAGEdge (statement) in sequence.
virtual bool isAliasedMR(const NodeBS &cpts, const MemRegion *mr)
Whether a region is aliased with a conditional points-to.
FunToPointsToMap funToModsMap
Map a function to its indirect defs of memory objects.
bool isNonLocalObject(NodeID id, const SVFFunction *curFun) const
CallSiteToPointsToMap callsiteToRefPointsToMap
Map a callsite to it refs cpts set.
Map< const StoreStmt *, NodeBS > StoresToPointsToMap
void addModSideEffectOfFunction(const SVFFunction *fun, const NodeBS &mods)
Add indirect def an memory object in the function.
FunToMRsMap funToMRsMap
Map a function to all its memory regions.
virtual ~MRGenerator()
Destructor.
virtual void generateMRs()
Start generating memory regions.
virtual void collectModRefForCall()
Generate regions for calls/rets.
const MemRegion * getMR(const NodeBS &cpts) const
Get a memory region according to cpts.
FunToPointsTosMap & getFunToPointsToList()
CallSiteToPointsToMap csToModsMap
Map a callsite to its indirect defs of memory objects.
OrderedMap< NodeBS, NodeBS, SVFUtil::equalNodeBS > PtsToRepPtsSetMap
virtual void sortPointsTo(const NodeBS &cpts)
Given a condition pts, insert into cptsToRepCPtsMap for region generation.
FIFOWorkList< NodeID > WorkList
Map< const SVFFunction *, PointsToList > FunToPointsTosMap
void addCPtsToLoad(NodeBS &cpts, const LoadStmt *ld, const SVFFunction *fun)
CallSiteToMRsMap callsiteToRefMRsMap
Map a callsite to its refs regions.
const NodeBS & getModSideEffectOfFunction(const SVFFunction *fun)
Get indirect mods of a function.
bool hasModMRSet(const CallICFGNode *cs)
StoresToPointsToMap storesToPointsToMap
Map a store SVFIR Edge to its CPts set map.
NodeBS & CollectPtsChain(NodeID id)
MRSet & getFunMRSet(const SVFFunction *fun)
Get Memory Region set.
Map< const PAGEdge *, const SVFFunction * > PAGEdgeToFunMap
bool addRefSideEffectOfCallSite(const CallICFGNode *cs, const NodeBS &refs)
Add indirect uses an memory object in the function.
SVFIR::SVFStmtList SVFStmtList
SVFIR edge list.
void addRefSideEffectOfFunction(const SVFFunction *fun, const NodeBS &refs)
Add/Get methods for side-effect of functions and callsites.
OrderedSet< NodeBS, SVFUtil::equalNodeBS > PointsToList
bool addModSideEffectOfCallSite(const CallICFGNode *cs, const NodeBS &mods)
Add indirect def an memory object in the function.
Map< const CallICFGNode *, NodeBS > CallSiteToNodeBSMap
Map a callsite to its indirect refs/mods of memory objects.
void addCPtsToCallSiteRefs(NodeBS &cpts, const CallICFGNode *cs)
NodeBS getRefInfoForCall(const CallICFGNode *cs)
bool hasRefSideEffectOfCallSite(const CallICFGNode *cs)
Has indirect refs of a callsite.
OrderedSet< const MemRegion *, MemRegion::equalMemRegion > MRSet
Get typedef from Pointer Analysis.
virtual void updateAliasMRs()
Update aliased regions for loads/stores/callsites.
void collectCallSitePts(const CallICFGNode *cs)
const NodeBS & getRepPointsTo(const NodeBS &cpts) const
Get superset cpts set.
PointsToList & getPointsToList(const SVFFunction *fun)
bool hasSVFStmtList(const ICFGNode *icfgNode)
Whether this instruction has SVFIR Edge.
Map< const SVFFunction *, NodeBS > FunToNodeBSMap
Maps Mod-Ref analysis.
Map< NodeID, NodeBS > NodeToPTSSMap
MRSet & getLoadMRSet(const LoadStmt *load)
PAGEdgeToFunMap pagEdgeToFunMap
Map a PAGEdge to its fun.
void getCallGraphSCCRevTopoOrder(WorkList &worklist)
Get reverse topo call graph scc.
PtsToRepPtsSetMap cptsToRepCPtsMap
Map a condition pts to its rep conditional pts (super set points-to)
void addCPtsToCallSiteMods(NodeBS &cpts, const CallICFGNode *cs)
CallSiteToPointsToMap callsiteToModPointsToMap
Map a callsite to it mods cpts set.
const NodeBS & getRefSideEffectOfFunction(const SVFFunction *fun)
Get indirect refs of a function.
virtual void getMRsForLoad(MRSet &aliasMRs, const NodeBS &cpts, const SVFFunction *)
Get memory regions for a load statement according to cpts.
virtual void partitionMRs()
Partition regions.
ModRefInfo getModRefInfo(const CallICFGNode *cs)
void createMR(const SVFFunction *fun, const NodeBS &cpts)
Generate a memory region and put in into functions which use it.
void destroy()
Clean up memory.
const NodeBS & getRefSideEffectOfCallSite(const CallICFGNode *cs)
Get indirect refs of a callsite.
CallSiteToPointsToMap csToRefsMap
Map a callsite to its indirect uses of memory objects.
virtual bool handleCallsiteModRef(NodeBS &mod, NodeBS &ref, const CallICFGNode *cs, const SVFFunction *fun)
Get Mod-Ref of a callee function.
NodeBS & getCallSiteArgsPts(const CallICFGNode *cs)
Return the pts chain of all callsite arguments.
Map< const LoadStmt *, NodeBS > LoadsToPointsToMap
Map loads/stores/callsites to their cpts set.
Map< const SVFFunction *, NodeBS > FunToPointsToMap
virtual void getAliasMemRegions(MRSet &aliasMRs, const NodeBS &cpts, const SVFFunction *fun)
Get all aliased mem regions from function fun according to cpts.
virtual void modRefAnalysis(PTACallGraphNode *callGraphNode, WorkList &worklist)
Mod-Ref analysis for callsite invoking this callGraphNode.
void getEscapObjviaGlobals(NodeBS &globs, const NodeBS &pts)
Get all the objects in callee's modref escaped via global objects (the chain pts of globals)
CallSiteToMRsMap callsiteToModMRsMap
Map a callsite to its mods regions.
MRSet & getCallSiteModMRSet(const CallICFGNode *cs)
NodeBS getModInfoForCall(const CallICFGNode *cs)
getModRefInfo APIs
const NodeBS & getModSideEffectOfCallSite(const CallICFGNode *cs)
Get indirect mods of a callsite.
bool hasRefMRSet(const CallICFGNode *cs)
NodeBS & getCallSiteRetPts(const CallICFGNode *cs)
Return the pts chain of the return parameter of the callsite.
NodeBS allGlobals
All global variable SVFIR node ids.
LoadsToPointsToMap loadsToPointsToMap
Map a load SVFIR Edge to its CPts set map.
void addCPtsToStore(NodeBS &cpts, const StoreStmt *st, const SVFFunction *fun)
Add cpts to store/load.
FunToPointsToMap funToRefsMap
Map a function to its indirect uses of memory objects.
SCCDetection< PTACallGraph * > SCC
Call Graph SCC.
MRSet memRegSet
A set of All memory regions.
Map< const CallICFGNode *, MRSet > CallSiteToMRsMap
Map< const StoreStmt *, MRSet > StoresToMRsMap
void collectGlobals()
Collect all global variables for later escape analysis.
CallSiteToPointsToMap csToCallSiteArgsPtsMap
Map a callsite to all its object might pass into its callees.
MemRegion(const NodeBS &cp)
Constructor.
static u32_t totalMRNum
region ID 0 is reserved
MRID getMRID() const
Return memory region ID.
const NodeBS & getPointsTo() const
Return points-to.
u32_t getRegionSize() const
Return memory object number inside a region.
std::string dumpStr() const
Dump string.
bool operator==(const MemRegion *rhs) const
Operator== overriding.
std::vector< const SVFStmt * > SVFStmtList
bool intersects(const SparseBitVector< ElementSize > *RHS) const
bool cmpNodeBS(const NodeBS &lpts, const NodeBS &rpts)
llvm::IRBuilder IRBuilder
bool operator()(const MemRegion *lhs, const MemRegion *rhs) const