36#ifndef MEMORYSSAPASS_H_
37#define MEMORYSSAPASS_H_
76 typedef std::vector<const MemRegion*>
MRVector;
93 typedef std::vector<const SVFBasicBlock*>
BBList;
327 if (
const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(inst))
330 assert(
hasMu &&
"not associated with mem region!");
338 if (
const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(
OrderedSet< const MemRegion *, MemRegion::equalMemRegion > MRSet
Get typedef from Pointer Analysis.
void setResVer(MRVer *v)
Set result operand ver.
void setOpVer(const MRVer *v, u32_t pos)
Set operand ver.
PHISet & getPHISet(const SVFBasicBlock *bb)
void AddStoreCHI(const SVFBasicBlock *bb, const StoreStmt *store, const MemRegion *mr)
std::vector< const SVFBasicBlock * > BBList
For phi insertion.
void RenamePhiOps(const PHISet &phiSet, u32_t pos, MRVector &)
Rename operands (RHS) of phis.
StoreCHI< Condition > STORECHI
u32_t getFunEntryChiNum() const
virtual void SSARename(const SVFFunction &fun)
SSA rename for a function.
BBToPhiSetMap bb2PhiSetMap
CallSiteToCHISetMap callsiteToChiSetMap
CHISet & getCHISet(const StoreStmt *st)
MemRegToCounterMap mr2CounterMap
void RenameMuSet(const MUSet &muSet)
Rename mus, chis and phis.
BVDataPTAImpl * getPTA() const
Return PTA.
LoadToMUSetMap & getLoadToMUSetMap()
u32_t getCallSiteChiNum() const
bool hasReturnMu(const SVFFunction *fun) const
void collectRegDefs(const SVFBasicBlock *bb, const MemRegion *mr)
MRGenerator::MRSet MRSet
Define mem region set.
static double timeOfGeneratingMemRegions
Statistics.
MRVer * newSSAName(const MemRegion *mr, MSSADEF *def)
Get a new SSA name of a memory region.
void AddStoreCHI(const SVFBasicBlock *bb, const StoreStmt *store, const MRSet &mrSet)
static double timeOfInsertingPHI
Time for inserting phis.
Map< const SVFFunction *, MUSet > FunToReturnMuSetMap
void destroy()
Release the memory.
MUSet & getReturnMuSet(const SVFFunction *fun)
SVFIR * getPAG()
Return SVFIR.
bool hasPHISet(const SVFBasicBlock *bb) const
void AddLoadMU(const SVFBasicBlock *bb, const LoadStmt *load, const MRSet &mrSet)
Add methods for mus/chis/phis.
Map< const CallICFGNode *, CHISet > CallSiteToCHISetMap
SVFIR::SVFStmtList SVFStmtList
SVFIR edge list.
LoadMU< Condition > LOADMU
static double timeOfCreateMUCHI
Time for generating mu/chi for load/store/calls.
virtual void buildMemSSA(const SVFFunction &fun)
We start from here.
StoreToChiSetMap & getStoreToChiSetMap()
CallCHI< Condition > CALLCHI
FunToEntryChiSetMap funToEntryChiSetMap
LoadToMUSetMap load2MuSetMap
Map< const CallICFGNode *, MUSet > CallSiteToMUSetMap
void RenameChiSet(const CHISet &chiSet, MRVector &memRegs)
Rename chi set.
CallSiteToMUSetMap & getCallSiteToMuSetMap()
void RenamePhiRes(const PHISet &phiSet, MRVector &memRegs)
Rename result (LHS) of phis.
MUSet & getMUSet(const CallICFGNode *cs)
u32_t getFunRetMuNum() const
virtual void createMUCHI(const SVFFunction &fun)
Create mu chi for candidate regions in a function.
EntryCHI< Condition > ENTRYCHI
bool hasMU(const CallICFGNode *cs) const
std::vector< std::unique_ptr< MRVer > > usedMRVers
FunToEntryChiSetMap & getFunToEntryChiSetMap()
StoreToChiSetMap store2ChiSetMap
void dumpMSSA(OutStream &Out=SVFUtil::outs())
Print Memory SSA.
CHISet & getCHISet(const CallICFGNode *cs)
CallMU< Condition > CALLMU
void AddMSSAPHI(const SVFBasicBlock *bb, const MemRegion *mr)
std::vector< const MemRegion * > MRVector
void collectRegUses(const MemRegion *mr)
Collect region uses and region defs according to mus/chis, in order to insert phis.
void performStat()
Perform statistics.
Map< const MemRegion *, BBList > MemRegToBBsMap
void AddCallSiteMU(const CallICFGNode *cs, const MRSet &mrSet)
Map< const LoadStmt *, MUSet > LoadToMUSetMap
static double timeOfSSARenaming
Time for SSA rename.
BBToPhiSetMap & getBBToPhiSetMap()
FunToReturnMuSetMap & getFunToRetMuSetMap()
u32_t getBBPhiNum() const
u32_t getCallSiteMuNum() const
u32_t getStoreChiNum() const
Map< const MemRegion *, std::vector< MRVer * > > MemRegToVerStackMap
For SSA renaming.
u32_t getLoadMuNum() const
Stat methods.
MRGenerator * getMRGenerator()
Return MRGenerator.
CallSiteToMUSetMap callsiteToMuSetMap
FunToReturnMuSetMap funToReturnMuSetMap
CHISet & getFuncEntryChiSet(const SVFFunction *fun)
bool hasCHI(const PAGEdge *inst) const
MemRegion::Condition Condition
define condition here changes needed if we add new type
Map< const SVFFunction *, CHISet > FunToEntryChiSetMap
Map from fun to its entry chi set and return mu set.
virtual void insertPHI(const SVFFunction &fun)
Insert phi for candidate regions in a function.
MRSet usedRegs
The following three set are used for prune SSA phi insertion.
Map< const SVFBasicBlock *, MRSet > BBToMRSetMap
Map< const StoreStmt *, CHISet > StoreToChiSetMap
MUSet & getMUSet(const LoadStmt *ld)
Get methods of mu/chi/phi.
void AddCallSiteCHI(const CallICFGNode *cs, const MRSet &mrSet)
void AddCallSiteMU(const CallICFGNode *cs, const MemRegion *mr)
CallSiteToCHISetMap & getCallSiteToChiSetMap()
MemRegToBBsMap reg2BBMap
Maps memory region to its basic block.
MRVer * getTopStackVer(const MemRegion *mr)
Get the last version of the SSA ver of memory region.
virtual ~MemSSA()
Destructor.
bool hasCHI(const CallICFGNode *cs) const
Map< const MemRegion *, MRVERSION > MemRegToCounterMap
void AddMSSAPHI(const SVFBasicBlock *bb, const MRSet &mrSet)
MemRegToVerStackMap mr2VerStackMap
MRSet varKills
Collect memory regions whose definition killed.
virtual void SSARenameBB(const SVFBasicBlock &bb)
SSA rename for a basic block.
bool hasFuncEntryChi(const SVFFunction *fun) const
Has function entry chi or return mu.
void AddLoadMU(const SVFBasicBlock *bb, const LoadStmt *load, const MemRegion *mr)
bool hasMU(const PAGEdge *inst) const
Has mu/chi methods.
void AddCallSiteCHI(const CallICFGNode *cs, const MemRegion *mr)
OrderedMap< const SVFBasicBlock *, PHISet > BBToPhiSetMap
std::vector< const SVFStmt * > SVFStmtList
std::ostream & outs()
Overwrite llvm::outs()
llvm::IRBuilder IRBuilder