|
Static Value-Flow Analysis
|
#include <MemSSA.h>
Static Public Attributes | |
| static double | timeOfGeneratingMemRegions = 0 |
| Statistics. | |
| static double | timeOfCreateMUCHI = 0 |
| Time for generating mu/chi for load/store/calls. | |
| static double | timeOfInsertingPHI = 0 |
| Time for inserting phis. | |
| static double | timeOfSSARenaming = 0 |
| Time for SSA rename. | |
Protected Member Functions | |
| virtual void | createMUCHI (const FunObjVar &fun) |
| Create mu chi for candidate regions in a function. | |
| virtual void | insertPHI (const FunObjVar &fun) |
| Insert phi for candidate regions in a function. | |
| virtual void | SSARename (const FunObjVar &fun) |
| SSA rename for a function. | |
| virtual void | SSARenameBB (const SVFBasicBlock &bb) |
| SSA rename for a basic block. | |
Protected Attributes | |
| BVDataPTAImpl * | pta |
| std::unique_ptr< MRGenerator > | mrGen |
| MemSSAStat * | stat |
Private Attributes | |
| LoadToMUSetMap | load2MuSetMap |
| StoreToChiSetMap | store2ChiSetMap |
| CallSiteToMUSetMap | callsiteToMuSetMap |
| CallSiteToCHISetMap | callsiteToChiSetMap |
| BBToPhiSetMap | bb2PhiSetMap |
| FunToEntryChiSetMap | funToEntryChiSetMap |
| FunToReturnMuSetMap | funToReturnMuSetMap |
| MemRegToVerStackMap | mr2VerStackMap |
| MemRegToCounterMap | mr2CounterMap |
| MRSet | usedRegs |
| The following three set are used for prune SSA phi insertion. | |
| MemRegToBBsMap | reg2BBMap |
| Maps memory region to its basic block. | |
| MRSet | varKills |
| Collect memory regions whose definition killed. | |
| std::vector< std::unique_ptr< MRVer > > | usedMRVers |
| void | destroy () |
| Release the memory. | |
| MRVer * | newSSAName (const MemRegion *mr, MSSADEF *def) |
| Get a new SSA name of a memory region. | |
| MRVer * | getTopStackVer (const MemRegion *mr) |
| Get the last version of the SSA ver of memory region. | |
| void | collectRegUses (const MemRegion *mr) |
| Collect region uses and region defs according to mus/chis, in order to insert phis. | |
| void | collectRegDefs (const SVFBasicBlock *bb, const MemRegion *mr) |
| void | AddLoadMU (const SVFBasicBlock *bb, const LoadStmt *load, const MRSet &mrSet) |
| Add methods for mus/chis/phis. | |
| void | AddStoreCHI (const SVFBasicBlock *bb, const StoreStmt *store, const MRSet &mrSet) |
| void | AddCallSiteMU (const CallICFGNode *cs, const MRSet &mrSet) |
| void | AddCallSiteCHI (const CallICFGNode *cs, const MRSet &mrSet) |
| void | AddMSSAPHI (const SVFBasicBlock *bb, const MRSet &mrSet) |
| void | AddLoadMU (const SVFBasicBlock *bb, const LoadStmt *load, const MemRegion *mr) |
| void | AddStoreCHI (const SVFBasicBlock *bb, const StoreStmt *store, const MemRegion *mr) |
| void | AddCallSiteMU (const CallICFGNode *cs, const MemRegion *mr) |
| void | AddCallSiteCHI (const CallICFGNode *cs, const MemRegion *mr) |
| void | AddMSSAPHI (const SVFBasicBlock *bb, const MemRegion *mr) |
| void | RenameMuSet (const MUSet &muSet) |
| Rename mus, chis and phis. | |
| void | RenameChiSet (const CHISet &chiSet, MRVector &memRegs) |
| Rename chi set. | |
| void | RenamePhiRes (const PHISet &phiSet, MRVector &memRegs) |
| Rename result (LHS) of phis. | |
| void | RenamePhiOps (const PHISet &phiSet, u32_t pos, MRVector &) |
| Rename operands (RHS) of phis. | |
| MemSSA (BVDataPTAImpl *p, std::unique_ptr< MRGenerator > mrGenerator) | |
| virtual | ~MemSSA () |
| Destructor. | |
| SVFIR * | getPAG () |
| Return SVFIR. | |
| BVDataPTAImpl * | getPTA () const |
| Return PTA. | |
| MRGenerator * | getMRGenerator () |
| Return MRGenerator (non-owning; MemSSA retains ownership). | |
| virtual void | buildMemSSA (const FunObjVar &fun) |
| We start from here. | |
| void | performStat () |
| Perform statistics. | |
| bool | hasMU (const PAGEdge *inst) const |
| Has mu/chi methods. | |
| bool | hasCHI (const PAGEdge *inst) const |
| bool | hasMU (const CallICFGNode *cs) const |
| bool | hasCHI (const CallICFGNode *cs) const |
| bool | hasFuncEntryChi (const FunObjVar *fun) const |
| Has function entry chi or return mu. | |
| bool | hasReturnMu (const FunObjVar *fun) const |
| CHISet & | getFuncEntryChiSet (const FunObjVar *fun) |
| MUSet & | getReturnMuSet (const FunObjVar *fun) |
| MUSet & | getMUSet (const LoadStmt *ld) |
| Get methods of mu/chi/phi. | |
| CHISet & | getCHISet (const StoreStmt *st) |
| MUSet & | getMUSet (const CallICFGNode *cs) |
| CHISet & | getCHISet (const CallICFGNode *cs) |
| PHISet & | getPHISet (const SVFBasicBlock *bb) |
| bool | hasPHISet (const SVFBasicBlock *bb) const |
| LoadToMUSetMap & | getLoadToMUSetMap () |
| StoreToChiSetMap & | getStoreToChiSetMap () |
| FunToReturnMuSetMap & | getFunToRetMuSetMap () |
| FunToEntryChiSetMap & | getFunToEntryChiSetMap () |
| CallSiteToMUSetMap & | getCallSiteToMuSetMap () |
| CallSiteToCHISetMap & | getCallSiteToChiSetMap () |
| BBToPhiSetMap & | getBBToPhiSetMap () |
| u32_t | getLoadMuNum () const |
| Stat methods. | |
| u32_t | getStoreChiNum () const |
| u32_t | getFunEntryChiNum () const |
| u32_t | getFunRetMuNum () const |
| u32_t | getCallSiteMuNum () const |
| u32_t | getCallSiteChiNum () const |
| u32_t | getBBPhiNum () const |
| void | dumpMSSA (OutStream &Out=SVFUtil::outs()) |
| Print Memory SSA. | |
| typedef std::vector<const SVFBasicBlock*> SVF::MemSSA::BBList |
| typedef Map<const SVFBasicBlock*, MRSet> SVF::MemSSA::BBToMRSetMap |
| typedef OrderedMap<const SVFBasicBlock*, PHISet> SVF::MemSSA::BBToPhiSetMap |
| typedef CallCHI<Condition> SVF::MemSSA::CALLCHI |
| typedef CallMU<Condition> SVF::MemSSA::CALLMU |
| typedef Map<const CallICFGNode*, CHISet> SVF::MemSSA::CallSiteToCHISetMap |
| typedef Map<const CallICFGNode*, MUSet> SVF::MemSSA::CallSiteToMUSetMap |
| typedef MSSACHI<Condition> SVF::MemSSA::CHI |
| typedef Set<CHI*> SVF::MemSSA::CHISet |
| typedef EntryCHI<Condition> SVF::MemSSA::ENTRYCHI |
| typedef Map<const FunObjVar*, CHISet> SVF::MemSSA::FunToEntryChiSetMap |
| typedef Map<const FunObjVar*, MUSet> SVF::MemSSA::FunToReturnMuSetMap |
| typedef LoadMU<Condition> SVF::MemSSA::LOADMU |
| typedef Map<const LoadStmt*, MUSet> SVF::MemSSA::LoadToMUSetMap |
| typedef MSSADEF SVF::MemSSA::MDEF |
| typedef Map<const MemRegion*, BBList> SVF::MemSSA::MemRegToBBsMap |
| typedef Map<const MemRegion*, MRVERSION> SVF::MemSSA::MemRegToCounterMap |
| typedef Map<const MemRegion*, std::vector<MRVer*> > SVF::MemSSA::MemRegToVerStackMap |
| typedef MRGenerator::MRSet SVF::MemSSA::MRSet |
| typedef std::vector<const MemRegion*> SVF::MemSSA::MRVector |
| typedef MSSAMU<Condition> SVF::MemSSA::MU |
| typedef Set<MU*> SVF::MemSSA::MUSet |
| typedef MSSAPHI<Condition> SVF::MemSSA::PHI |
| typedef Set<PHI*> SVF::MemSSA::PHISet |
| typedef RetMU<Condition> SVF::MemSSA::RETMU |
| typedef StoreCHI<Condition> SVF::MemSSA::STORECHI |
| typedef Map<const StoreStmt*, CHISet> SVF::MemSSA::StoreToChiSetMap |
| Enumerator | |
|---|---|
| Distinct | |
| IntraDisjoint | |
| InterDisjoint | |
| MemSSA::MemSSA | ( | BVDataPTAImpl * | p, |
| std::unique_ptr< MRGenerator > | mrGenerator ) |
Constructor. The builder (SVFGBuilder::createMRGenerator) supplies the MRGenerator and decides the partition strategy / thread-awareness; MemSSA takes ownership of it via unique_ptr. mrGenerator must not be null.
Constructor
Generate whole program memory regions
Definition at line 49 of file MemSSA.cpp.
|
inlinevirtual |
|
inlineprivate |
Definition at line 233 of file MemSSA.h.
|
inlineprivate |
Definition at line 204 of file MemSSA.h.
|
inlineprivate |
|
inlineprivate |
Definition at line 199 of file MemSSA.h.
|
inlineprivate |
|
inlineprivate |
Add methods for mus/chis/phis.
Definition at line 189 of file MemSSA.h.
|
inlineprivate |
|
inlineprivate |
Definition at line 209 of file MemSSA.h.
|
inlineprivate |
Definition at line 220 of file MemSSA.h.
|
inlineprivate |
Definition at line 194 of file MemSSA.h.
|
virtual |
We start from here.
Start building memory SSA
Create mus/chis for loads/stores/calls for memory regions
Insert PHI for memory regions
SSA rename for memory regions
Definition at line 74 of file MemSSA.cpp.
|
inlineprivate |
Definition at line 180 of file MemSSA.h.
|
inlineprivate |
|
protectedvirtual |
Create mu chi for candidate regions in a function.
Create mu/chi according to memory regions collect used mrs in usedRegs and construction map from region to BB for prune SSA phi insertion
get all reachable basic blocks from function entry ignore dead basic blocks
if the function does not have a reachable return instruction from function entry then we won't create return mu for it
Definition at line 109 of file MemSSA.cpp.
|
private |
Release the memory.
Clean up memory
Definition at line 360 of file MemSSA.cpp.
| void MemSSA::dumpMSSA | ( | OutStream & | Out = SVFUtil::outs() | ) |
Print Memory SSA.
Print SSA
Definition at line 569 of file MemSSA.cpp.
| u32_t MemSSA::getBBPhiNum | ( | ) | const |
Get PHI numbers
Definition at line 553 of file MemSSA.cpp.
|
inline |
| u32_t MemSSA::getCallSiteChiNum | ( | ) | const |
Get CallCHI numbers
Definition at line 536 of file MemSSA.cpp.
| u32_t MemSSA::getCallSiteMuNum | ( | ) | const |
Get CallMU numbers
Definition at line 519 of file MemSSA.cpp.
|
inline |
|
inline |
|
inline |
| u32_t MemSSA::getFunEntryChiNum | ( | ) | const |
Get EntryCHI numbers
Definition at line 485 of file MemSSA.cpp.
| u32_t MemSSA::getFunRetMuNum | ( | ) | const |
Get RetMU numbers
Definition at line 502 of file MemSSA.cpp.
|
inline |
|
inline |
| u32_t MemSSA::getLoadMuNum | ( | ) | const |
Stat methods.
Get loadMU numbers
Definition at line 451 of file MemSSA.cpp.
|
inline |
|
inline |
Return MRGenerator (non-owning; MemSSA retains ownership).
|
inline |
Get methods of mu/chi/phi.
|
inline |
|
inline |
|
inline |
| u32_t MemSSA::getStoreChiNum | ( | ) | const |
Get StoreCHI numbers
Definition at line 468 of file MemSSA.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
Has function entry chi or return mu.
|
inline |
|
inline |
|
inline |
|
inline |
|
protectedvirtual |
Insert phi for candidate regions in a function.
Definition at line 195 of file MemSSA.cpp.
Get a new SSA name of a memory region.
Definition at line 341 of file MemSSA.cpp.
| void MemSSA::performStat | ( | ) |
Rename chi set.
Definition at line 260 of file MemSSA.h.
|
inlineprivate |
Rename mus, chis and phis.
Rename mu set
Definition at line 249 of file MemSSA.h.
Rename operands (RHS) of phis.
Definition at line 285 of file MemSSA.h.
Rename result (LHS) of phis.
Definition at line 273 of file MemSSA.h.
|
protectedvirtual |
SSA rename for a function.
SSA construction algorithm
Definition at line 243 of file MemSSA.cpp.
|
protectedvirtual |
SSA rename for a basic block.
Renaming for each memory regions See the renaming algorithm in book Engineering A Compiler (Figure 9.12)
Definition at line 256 of file MemSSA.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
private |
|
protected |
|
private |
|
static |
|
static |
|
static |
|
static |
|
private |
|
private |
|
private |