Static Value-Flow Analysis
Loading...
Searching...
No Matches
MemSSA.cpp
Go to the documentation of this file.
1//===- MemSSA.cpp -- Base class of pointer analyses------------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-2017> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23/*
24 * MemSSA.cpp
25 *
26 * Created on: Dec 14, 2013
27 * Author: Yulei Sui
28 */
29
30#include "Util/Options.h"
32#include "MSSA/MemPartition.h"
33#include "MSSA/MemSSA.h"
34#include "Graphs/SVFGStat.h"
35#include "Graphs/CallGraph.h"
36#include "SVFIR/SVFVariables.h"
37
38using namespace SVF;
39using namespace SVFUtil;
40
45
49MemSSA::MemSSA(BVDataPTAImpl* p, bool ptrOnlyMSSA)
50{
51 pta = p;
53 && "please specify a pointer analysis");
54
56 mrGen = new DistinctMRG(pta, ptrOnlyMSSA);
58 mrGen = new IntraDisjointMRG(pta, ptrOnlyMSSA);
60 mrGen = new InterDisjointMRG(pta, ptrOnlyMSSA);
61 else
62 assert(false && "unrecognised memory partition strategy");
63
64
65 stat = new MemSSAStat(this);
66
68 double mrStart = stat->getClk(true);
70 double mrEnd = stat->getClk(true);
72}
73
75{
76 return pta->getPAG();
77}
78
83{
84
85 assert(!isExtCall(&fun) && "we do not build memory ssa for external functions");
86
87 DBOUT(DMSSA, outs() << "Building Memory SSA for function " << fun.getName()
88 << " \n");
89
90 usedRegs.clear();
91 reg2BBMap.clear();
92
94 double muchiStart = stat->getClk(true);
95 createMUCHI(fun);
96 double muchiEnd = stat->getClk(true);
98
100 double phiStart = stat->getClk(true);
101 insertPHI(fun);
102 double phiEnd = stat->getClk(true);
104
106 double renameStart = stat->getClk(true);
107 SSARename(fun);
108 double renameEnd = stat->getClk(true);
110
111}
112
118{
119
120
121 DBOUT(DMSSA,
122 outs() << "\t creating mu chi for function " << fun.getName()
123 << "\n");
124 // 1. create mu/chi
125 // insert a set of mus for memory regions at each load
126 // inset a set of chis for memory regions at each store
127
128 // 2. find global names (region name before renaming) of each memory region,
129 // collect used mrs in usedRegs, and collect its def basic block in reg2BBMap
130 // in the form of mu(r) and r = chi (r)
131 // a) mu(r):
132 // if(r \not\in varKills) global = global \cup r
133 // b) r = chi(r):
134 // if(r \not\in varKills) global = global \cup r
135 // varKills = varKills \cup r
136 // block(r) = block(r) \cup bb_{chi}
137
140 BBList reachableBBs = fun.getReachableBBs();
141
142 for (BBList::const_iterator iter = reachableBBs.begin(), eiter = reachableBBs.end();
143 iter != eiter; ++iter)
144 {
145 const SVFBasicBlock* bb = *iter;
146 varKills.clear();
147 for (const auto& inst: bb->getICFGNodeList())
148 {
149 if(mrGen->hasSVFStmtList(inst))
150 {
152 for (SVFStmtList::const_iterator bit = pagEdgeList.begin(),
153 ebit = pagEdgeList.end(); bit != ebit; ++bit)
154 {
155 const PAGEdge* inst = *bit;
156 if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(inst))
157 AddLoadMU(bb, load, mrGen->getLoadMRSet(load));
158 else if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(inst))
159 AddStoreCHI(bb, store, mrGen->getStoreMRSet(store));
160 }
161 }
162 if (isNonInstricCallSite(inst))
163 {
164 const CallICFGNode* cs = cast<CallICFGNode>(inst);
165 if(mrGen->hasRefMRSet(cs))
167
168 if(mrGen->hasModMRSet(cs))
170 }
171 }
172 }
173
174 // create entry chi for this function including all memory regions
175 // initialize them with version 0 and 1 r_1 = chi (r_0)
176 for (MRSet::iterator iter = usedRegs.begin(), eiter = usedRegs.end();
177 iter != eiter; ++iter)
178 {
179 const MemRegion* mr = *iter;
180 // initialize mem region version and stack for renaming phase
181 mr2CounterMap[mr] = 0;
182 mr2VerStackMap[mr].clear();
183 ENTRYCHI* chi = new ENTRYCHI(&fun, mr);
184 chi->setOpVer(newSSAName(mr,chi));
185 chi->setResVer(newSSAName(mr,chi));
186 funToEntryChiSetMap[&fun].insert(chi);
187
190 if(fun.hasReturn())
191 {
192 RETMU* mu = new RETMU(&fun, mr);
193 funToReturnMuSetMap[&fun].insert(mu);
194 }
195
196 }
197
198}
199
200/*
201 * Insert phi node
202 */
204{
205
206 DBOUT(DMSSA,
207 outs() << "\t insert phi for function " << fun.getName() << "\n");
208
210 // record whether a phi of mr has already been inserted into the bb.
212
213 // start inserting phi node
214 for (MRSet::iterator iter = usedRegs.begin(), eiter = usedRegs.end();
215 iter != eiter; ++iter)
216 {
217 const MemRegion* mr = *iter;
218
219 BBList bbs = reg2BBMap[mr];
220 while (!bbs.empty())
221 {
222 const SVFBasicBlock* bb = bbs.back();
223 bbs.pop_back();
224 Map<const SVFBasicBlock*,Set<const SVFBasicBlock*>>::const_iterator it = df.find(bb);
225 if(it == df.end())
226 {
227 writeWrnMsg("bb not in the dominance frontier map??");
228 continue;
229 }
230 const Set<const SVFBasicBlock*>& domSet = it->second;
231 for (const SVFBasicBlock* pbb : domSet)
232 {
233 // if we never insert this phi node before
234 if (0 == bb2MRSetMap[pbb].count(mr))
235 {
236 bb2MRSetMap[pbb].insert(mr);
237 // insert phi node
238 AddMSSAPHI(pbb,mr);
239 // continue to insert phi in its iterative dominate frontiers
240 bbs.push_back(pbb);
241 }
242 }
243 }
244 }
245
246}
247
252{
253
254 DBOUT(DMSSA,
255 outs() << "\t ssa rename for function " << fun.getName() << "\n");
256
258}
259
265{
266
267 // record which mem region needs to pop stack
269
270 // rename phi result op
271 // for each r = phi (...)
272 // rewrite r as new name
273 if (hasPHISet(&bb))
275
276
277 // process mu and chi
278 // for each mu(r)
279 // rewrite r with top mrver of stack(r)
280 // for each r = chi(r')
281 // rewrite r' with top mrver of stack(r)
282 // rewrite r with new name
283
284 for (const auto& pNode: bb.getICFGNodeList())
285 {
287 {
289 for(SVFStmtList::const_iterator bit = pagEdgeList.begin(), ebit= pagEdgeList.end();
290 bit!=ebit; ++bit)
291 {
292 const PAGEdge* inst = *bit;
293 if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(inst))
294 RenameMuSet(getMUSet(load));
295
296 else if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(inst))
298
299 }
300 }
302 {
304 if(mrGen->hasRefMRSet(cs))
306
307 if(mrGen->hasModMRSet(cs))
309 }
310 else if(isRetInstNode(pNode))
311 {
312 const FunObjVar* fun = bb.getParent();
314 }
315 }
316
317
318 // fill phi operands of succ basic blocks
319 for (const SVFBasicBlock* succ : bb.getSuccessors())
320 {
322 if (hasPHISet(succ))
324 }
325
326 // for succ basic block in dominator tree
327 const FunObjVar* fun = bb.getParent();
329 Map<const SVFBasicBlock*,Set<const SVFBasicBlock*>>::const_iterator mapIter = dtBBsMap.find(&bb);
330 if (mapIter != dtBBsMap.end())
331 {
332 const Set<const SVFBasicBlock*>& dtBBs = mapIter->second;
333 for (const SVFBasicBlock* dtbb : dtBBs)
334 {
336 }
337 }
338 // for each r = chi(..), and r = phi(..)
339 // pop ver stack(r)
340 while (!memRegs.empty())
341 {
342 const MemRegion* mr = memRegs.back();
343 memRegs.pop_back();
344 mr2VerStackMap[mr].pop_back();
345 }
346
347}
348
350{
351 assert(0 != mr2CounterMap.count(mr)
352 && "did not find initial version in map? ");
353 assert(0 != mr2VerStackMap.count(mr)
354 && "did not find initial stack in map? ");
355
356 MRVERSION version = mr2CounterMap[mr];
357 mr2CounterMap[mr] = version + 1;
358 auto mrVer = std::make_unique<MRVer>(mr, version, def);
359 auto mrVerPtr = mrVer.get();
360 mr2VerStackMap[mr].push_back(mrVerPtr);
361 usedMRVers.push_back(std::move(mrVer));
362 return mrVerPtr;
363}
364
369{
370
371 for (LoadToMUSetMap::iterator iter = load2MuSetMap.begin(), eiter =
372 load2MuSetMap.end(); iter != eiter; ++iter)
373 {
374 for (MUSet::iterator it = iter->second.begin(), eit =
375 iter->second.end(); it != eit; ++it)
376 {
377 delete *it;
378 }
379 }
380
381 for (StoreToChiSetMap::iterator iter = store2ChiSetMap.begin(), eiter =
382 store2ChiSetMap.end(); iter != eiter; ++iter)
383 {
384 for (CHISet::iterator it = iter->second.begin(), eit =
385 iter->second.end(); it != eit; ++it)
386 {
387 delete *it;
388 }
389 }
390
391 for (CallSiteToMUSetMap::iterator iter = callsiteToMuSetMap.begin(),
392 eiter = callsiteToMuSetMap.end(); iter != eiter; ++iter)
393 {
394 for (MUSet::iterator it = iter->second.begin(), eit =
395 iter->second.end(); it != eit; ++it)
396 {
397 delete *it;
398 }
399 }
400
401 for (CallSiteToCHISetMap::iterator iter = callsiteToChiSetMap.begin(),
402 eiter = callsiteToChiSetMap.end(); iter != eiter; ++iter)
403 {
404 for (CHISet::iterator it = iter->second.begin(), eit =
405 iter->second.end(); it != eit; ++it)
406 {
407 delete *it;
408 }
409 }
410
411 for (FunToEntryChiSetMap::iterator iter = funToEntryChiSetMap.begin(),
412 eiter = funToEntryChiSetMap.end(); iter != eiter; ++iter)
413 {
414 for (CHISet::iterator it = iter->second.begin(), eit =
415 iter->second.end(); it != eit; ++it)
416 {
417 delete *it;
418 }
419 }
420
421 for (FunToReturnMuSetMap::iterator iter = funToReturnMuSetMap.begin(),
422 eiter = funToReturnMuSetMap.end(); iter != eiter; ++iter)
423 {
424 for (MUSet::iterator it = iter->second.begin(), eit =
425 iter->second.end(); it != eit; ++it)
426 {
427 delete *it;
428 }
429 }
430
431 for (BBToPhiSetMap::iterator iter = bb2PhiSetMap.begin(), eiter =
432 bb2PhiSetMap.end(); iter != eiter; ++iter)
433 {
434 for (PHISet::iterator it = iter->second.begin(), eit =
435 iter->second.end(); it != eit; ++it)
436 {
437 delete *it;
438 }
439 }
440
441 delete mrGen;
442 mrGen = nullptr;
443 delete stat;
444 stat = nullptr;
445 pta = nullptr;
446}
447
452{
453 if(pta->printStat())
454 stat->performStat();
455}
456
461{
462 u32_t num = 0;
463 LoadToMUSetMap::const_iterator it = load2MuSetMap.begin();
464 LoadToMUSetMap::const_iterator eit = load2MuSetMap.end();
465 for (; it != eit; it++)
466 {
467 const MUSet & muSet = it->second;
468 num+= muSet.size();
469 }
470 return num;
471}
472
473
478{
479 u32_t num = 0;
480 StoreToChiSetMap::const_iterator it = store2ChiSetMap.begin();
481 StoreToChiSetMap::const_iterator eit = store2ChiSetMap.end();
482 for (; it != eit; it++)
483 {
484 const CHISet& chiSet = it->second;
485 num += chiSet.size();
486 }
487 return num;
488}
489
490
495{
496 u32_t num = 0;
497 FunToEntryChiSetMap::const_iterator it = funToEntryChiSetMap.begin();
498 FunToEntryChiSetMap::const_iterator eit = funToEntryChiSetMap.end();
499 for (; it != eit; it++)
500 {
501 const CHISet& chiSet = it->second;
502 num += chiSet.size();
503 }
504 return num;
505}
506
507
512{
513 u32_t num = 0;
514 FunToReturnMuSetMap::const_iterator it = funToReturnMuSetMap.begin();
515 FunToReturnMuSetMap::const_iterator eit = funToReturnMuSetMap.end();
516 for (; it != eit; it++)
517 {
518 const MUSet & muSet = it->second;
519 num+= muSet.size();
520 }
521 return num;
522}
523
524
529{
530 u32_t num = 0;
531 CallSiteToMUSetMap::const_iterator it = callsiteToMuSetMap.begin();
532 CallSiteToMUSetMap::const_iterator eit = callsiteToMuSetMap.end();
533 for (; it != eit; it++)
534 {
535 const MUSet & muSet = it->second;
536 num+= muSet.size();
537 }
538 return num;
539}
540
541
546{
547 u32_t num = 0;
548 CallSiteToCHISetMap::const_iterator it = callsiteToChiSetMap.begin();
549 CallSiteToCHISetMap::const_iterator eit = callsiteToChiSetMap.end();
550 for (; it != eit; it++)
551 {
552 const CHISet & chiSet = it->second;
553 num+= chiSet.size();
554 }
555 return num;
556}
557
558
563{
564 u32_t num = 0;
565 BBToPhiSetMap::const_iterator it = bb2PhiSetMap.begin();
566 BBToPhiSetMap::const_iterator eit = bb2PhiSetMap.end();
567 for (; it != eit; it++)
568 {
569 const PHISet & phiSet = it->second;
570 num+= phiSet.size();
571 }
572 return num;
573}
574
579{
580
582 for (const auto& item: *svfirCallGraph)
583 {
584 const FunObjVar* fun = item.second->getFunction();
585 if(Options::MSSAFun()!="" && Options::MSSAFun()!=fun->getName())
586 continue;
587
588 Out << "==========FUNCTION: " << fun->getName() << "==========\n";
589 // dump function entry chi nodes
590 if (hasFuncEntryChi(fun))
591 {
593 for (CHISet::iterator chi_it = entry_chis.begin(); chi_it != entry_chis.end(); chi_it++)
594 {
595 (*chi_it)->dump();
596 }
597 }
598
599 for (FunObjVar::const_bb_iterator bit = fun->begin(), ebit = fun->end();
600 bit != ebit; ++bit)
601 {
602 const SVFBasicBlock* bb = bit->second;
603 Out << bb->getName() << "\n";
604 PHISet& phiSet = getPHISet(bb);
605 for(PHISet::iterator pi = phiSet.begin(), epi = phiSet.end(); pi !=epi; ++pi)
606 {
607 (*pi)->dump();
608 }
609
610 bool last_is_chi = false;
611 for (const auto& inst: bb->getICFGNodeList())
612 {
613 bool isAppCall = isNonInstricCallSite(inst) && !isExtCall(inst);
614 if (isAppCall || isHeapAllocExtCall(inst))
615 {
616 const CallICFGNode* cs = cast<CallICFGNode>(inst);
617 if(hasMU(cs))
618 {
619 if (!last_is_chi)
620 {
621 Out << "\n";
622 }
623 for (MUSet::iterator mit = getMUSet(cs).begin(), emit = getMUSet(cs).end();
624 mit != emit; ++mit)
625 {
626 (*mit)->dump();
627 }
628 }
629
630 Out << inst->toString() << "\n";
631
632 if(hasCHI(cs))
633 {
634 for (CHISet::iterator cit = getCHISet(cs).begin(), ecit = getCHISet(cs).end();
635 cit != ecit; ++cit)
636 {
637 (*cit)->dump();
638 }
639 Out << "\n";
640 last_is_chi = true;
641 }
642 else
643 last_is_chi = false;
644 }
645 else
646 {
647 bool dump_preamble = false;
649 for(SVFStmtList::const_iterator bit = pagEdgeList.begin(), ebit= pagEdgeList.end();
650 bit!=ebit; ++bit)
651 {
652 const PAGEdge* edge = *bit;
653 if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(edge))
654 {
655 MUSet& muSet = getMUSet(load);
656 for(MUSet::iterator it = muSet.begin(), eit = muSet.end(); it!=eit; ++it)
657 {
658 if (!dump_preamble && !last_is_chi)
659 {
660 Out << "\n";
661 dump_preamble = true;
662 }
663 (*it)->dump();
664 }
665 }
666 }
667
668 Out << inst->toString() << "\n";
669
670 bool has_chi = false;
671 for(SVFStmtList::const_iterator bit = pagEdgeList.begin(), ebit= pagEdgeList.end();
672 bit!=ebit; ++bit)
673 {
674 const PAGEdge* edge = *bit;
675 if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(edge))
676 {
677 CHISet& chiSet = getCHISet(store);
678 for(CHISet::iterator it = chiSet.begin(), eit = chiSet.end(); it!=eit; ++it)
679 {
680 has_chi = true;
681 (*it)->dump();
682 }
683 }
684 }
685 if (has_chi)
686 {
687 Out << "\n";
688 last_is_chi = true;
689 }
690 else
691 last_is_chi = false;
692 }
693 }
694 }
695
696 // dump return mu nodes
697 if (hasReturnMu(fun))
698 {
700 for (MUSet::iterator mu_it = return_mus.begin(); mu_it != return_mus.end(); mu_it++)
701 {
702 (*mu_it)->dump();
703 }
704 }
705 }
706}
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
Definition SVFType.h:576
#define TIMEINTERVAL
Definition SVFType.h:604
#define DMSSA
Definition SVFType.h:593
cJSON * p
Definition cJSON.cpp:2559
cJSON * item
Definition cJSON.h:222
int count
Definition cJSON.h:216
BasicBlockGraph::IDToNodeMapTy::const_iterator const_bb_iterator
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
const_bb_iterator begin() const
const SVFBasicBlock * getEntryBlock() const
const_bb_iterator end() const
const std::vector< const SVFBasicBlock * > & getReachableBBs() const
bool hasReturn() const
MRSet & getStoreMRSet(const StoreStmt *store)
Definition MemRegion.h:453
MRSet & getCallSiteRefMRSet(const CallICFGNode *cs)
Definition MemRegion.h:465
virtual void generateMRs()
Start generating memory regions.
bool hasModMRSet(const CallICFGNode *cs)
Definition MemRegion.h:461
bool hasSVFStmtList(const ICFGNode *icfgNode)
Whether this instruction has SVFIR Edge.
MRSet & getLoadMRSet(const LoadStmt *load)
Definition MemRegion.h:449
SVFStmtList & getSVFStmtsFromInst(const ICFGNode *node)
Given an instruction, get all its the PAGEdge (statement) in sequence.
MRSet & getCallSiteModMRSet(const CallICFGNode *cs)
Definition MemRegion.h:469
bool hasRefMRSet(const CallICFGNode *cs)
Definition MemRegion.h:457
Memory Region class.
Definition MemRegion.h:60
virtual void performStat() override
Definition SVFGStat.cpp:74
PHISet & getPHISet(const SVFBasicBlock *bb)
Definition MemSSA.h:397
std::vector< const SVFBasicBlock * > BBList
For phi insertion.
Definition MemSSA.h:93
void RenamePhiOps(const PHISet &phiSet, u32_t pos, MRVector &)
Rename operands (RHS) of phis.
Definition MemSSA.h:285
u32_t getFunEntryChiNum() const
Definition MemSSA.cpp:494
BBToPhiSetMap bb2PhiSetMap
Definition MemSSA.h:138
CallSiteToCHISetMap callsiteToChiSetMap
Definition MemSSA.h:137
MRGenerator * mrGen
Definition MemSSA.h:122
CHISet & getCHISet(const StoreStmt *st)
Definition MemSSA.h:385
MemRegToCounterMap mr2CounterMap
Definition MemSSA.h:144
void RenameMuSet(const MUSet &muSet)
Rename mus, chis and phis.
Definition MemSSA.h:249
virtual void createMUCHI(const FunObjVar &fun)
Create mu chi for candidate regions in a function.
Definition MemSSA.cpp:117
u32_t getCallSiteChiNum() const
Definition MemSSA.cpp:545
static double timeOfGeneratingMemRegions
Statistics.
Definition MemSSA.h:107
MRVer * newSSAName(const MemRegion *mr, MSSADEF *def)
Get a new SSA name of a memory region.
Definition MemSSA.cpp:349
void AddStoreCHI(const SVFBasicBlock *bb, const StoreStmt *store, const MRSet &mrSet)
Definition MemSSA.h:194
static double timeOfInsertingPHI
Time for inserting phis.
Definition MemSSA.h:109
bool hasReturnMu(const FunObjVar *fun) const
Definition MemSSA.h:364
void destroy()
Release the memory.
Definition MemSSA.cpp:368
SVFIR * getPAG()
Return SVFIR.
Definition MemSSA.cpp:74
bool hasPHISet(const SVFBasicBlock *bb) const
Definition MemSSA.h:401
void AddLoadMU(const SVFBasicBlock *bb, const LoadStmt *load, const MRSet &mrSet)
Add methods for mus/chis/phis.
Definition MemSSA.h:189
SVFIR::SVFStmtList SVFStmtList
SVFIR edge list.
Definition MemSSA.h:103
BVDataPTAImpl * pta
Definition MemSSA.h:121
static double timeOfCreateMUCHI
Time for generating mu/chi for load/store/calls.
Definition MemSSA.h:108
MemSSAStat * stat
Definition MemSSA.h:123
CHISet & getFuncEntryChiSet(const FunObjVar *fun)
Definition MemSSA.h:369
FunToEntryChiSetMap funToEntryChiSetMap
Definition MemSSA.h:140
virtual void insertPHI(const FunObjVar &fun)
Insert phi for candidate regions in a function.
Definition MemSSA.cpp:203
LoadToMUSetMap load2MuSetMap
Definition MemSSA.h:134
void RenameChiSet(const CHISet &chiSet, MRVector &memRegs)
Rename chi set.
Definition MemSSA.h:260
void RenamePhiRes(const PHISet &phiSet, MRVector &memRegs)
Rename result (LHS) of phis.
Definition MemSSA.h:273
u32_t getFunRetMuNum() const
Definition MemSSA.cpp:511
EntryCHI< Condition > ENTRYCHI
Definition MemSSA.h:64
MemSSA(BVDataPTAImpl *p, bool ptrOnlyMSSA)
Constructor.
Definition MemSSA.cpp:49
std::vector< std::unique_ptr< MRVer > > usedMRVers
Definition MemSSA.h:157
StoreToChiSetMap store2ChiSetMap
Definition MemSSA.h:135
void dumpMSSA(OutStream &Out=SVFUtil::outs())
Print Memory SSA.
Definition MemSSA.cpp:578
std::vector< const MemRegion * > MRVector
Definition MemSSA.h:76
Set< MU * > MUSet
Definition MemSSA.h:70
void performStat()
Perform statistics.
Definition MemSSA.cpp:451
Set< PHI * > PHISet
Definition MemSSA.h:72
virtual void buildMemSSA(const FunObjVar &fun)
We start from here.
Definition MemSSA.cpp:82
void AddCallSiteMU(const CallICFGNode *cs, const MRSet &mrSet)
Definition MemSSA.h:199
bool hasFuncEntryChi(const FunObjVar *fun) const
Has function entry chi or return mu.
Definition MemSSA.h:360
RetMU< Condition > RETMU
Definition MemSSA.h:60
static double timeOfSSARenaming
Time for SSA rename.
Definition MemSSA.h:110
u32_t getBBPhiNum() const
Definition MemSSA.cpp:562
u32_t getCallSiteMuNum() const
Definition MemSSA.cpp:528
u32_t getStoreChiNum() const
Definition MemSSA.cpp:477
u32_t getLoadMuNum() const
Stat methods.
Definition MemSSA.cpp:460
CallSiteToMUSetMap callsiteToMuSetMap
Definition MemSSA.h:136
FunToReturnMuSetMap funToReturnMuSetMap
Definition MemSSA.h:141
bool hasCHI(const PAGEdge *inst) const
Definition MemSSA.h:336
@ InterDisjoint
Definition MemSSA.h:117
@ IntraDisjoint
Definition MemSSA.h:116
virtual void SSARename(const FunObjVar &fun)
SSA rename for a function.
Definition MemSSA.cpp:251
MRSet usedRegs
The following three set are used for prune SSA phi insertion.
Definition MemSSA.h:150
Map< const SVFBasicBlock *, MRSet > BBToMRSetMap
Definition MemSSA.h:94
MUSet & getMUSet(const LoadStmt *ld)
Get methods of mu/chi/phi.
Definition MemSSA.h:381
void AddCallSiteCHI(const CallICFGNode *cs, const MRSet &mrSet)
Definition MemSSA.h:204
MUSet & getReturnMuSet(const FunObjVar *fun)
Definition MemSSA.h:373
MemRegToBBsMap reg2BBMap
Maps memory region to its basic block.
Definition MemSSA.h:152
void AddMSSAPHI(const SVFBasicBlock *bb, const MRSet &mrSet)
Definition MemSSA.h:209
MemRegToVerStackMap mr2VerStackMap
Definition MemSSA.h:143
MRSet varKills
Collect memory regions whose definition killed.
Definition MemSSA.h:154
virtual void SSARenameBB(const SVFBasicBlock &bb)
SSA rename for a basic block.
Definition MemSSA.cpp:264
bool hasMU(const PAGEdge *inst) const
Has mu/chi methods.
Definition MemSSA.h:325
Set< CHI * > CHISet
Definition MemSSA.h:71
static const OptionMap< u32_t > MemPar
Definition Options.h:141
static const Option< std::string > MSSAFun
Definition Options.h:139
bool printStat()
Whether print statistics.
SVFIR * getPAG() const
PTATY getAnalysisTy() const
Type of pointer analysis.
const FunObjVar * getParent() const
const std::vector< const ICFGNode * > & getICFGNodeList() const
u32_t getBBPredecessorPos(const SVFBasicBlock *succbb)
const ICFGNode * back() const
std::vector< const SVFBasicBlock * > getSuccessors() const
const CallGraph * getCallGraph()
Get CG.
Definition SVFIR.h:248
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition SVFIR.h:120
static double getClk(bool mark=false)
Definition SVFStat.cpp:51
virtual const std::string & getName() const
Definition SVFValue.h:186
bool isHeapAllocExtCall(const ICFGNode *cs)
Definition SVFUtil.cpp:361
bool isNonInstricCallSite(const ICFGNode *inst)
Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls.
Definition SVFUtil.h:182
bool isExtCall(const FunObjVar *fun)
Definition SVFUtil.cpp:441
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
Definition SVFUtil.cpp:72
bool isRetInstNode(const ICFGNode *node)
Definition SVFUtil.cpp:380
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52
for isBitcode
Definition BasicTypes.h:70
@ Default_PTA
default pta without any analysis
Definition PTATY.h:35
NodeID MRVERSION
Definition MemRegion.h:56
std::ostream OutStream
Definition GeneralType.h:66
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76
unsigned u32_t
Definition GeneralType.h:67