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"
31#include "MSSA/MemPartition.h"
32#include "MSSA/MemSSA.h"
33#include "Graphs/SVFGStat.h"
34#include "Graphs/CallGraph.h"
35
36using namespace SVF;
37using namespace SVFUtil;
38
43
47MemSSA::MemSSA(BVDataPTAImpl* p, bool ptrOnlyMSSA)
48{
49 pta = p;
51 && "please specify a pointer analysis");
52
54 mrGen = new DistinctMRG(pta, ptrOnlyMSSA);
56 mrGen = new IntraDisjointMRG(pta, ptrOnlyMSSA);
58 mrGen = new InterDisjointMRG(pta, ptrOnlyMSSA);
59 else
60 assert(false && "unrecognised memory partition strategy");
61
62
63 stat = new MemSSAStat(this);
64
66 double mrStart = stat->getClk(true);
68 double mrEnd = stat->getClk(true);
70}
71
73{
74 return pta->getPAG();
75}
76
81{
82
83 assert(!isExtCall(&fun) && "we do not build memory ssa for external functions");
84
85 DBOUT(DMSSA, outs() << "Building Memory SSA for function " << fun.getName()
86 << " \n");
87
88 usedRegs.clear();
89 reg2BBMap.clear();
90
92 double muchiStart = stat->getClk(true);
93 createMUCHI(fun);
94 double muchiEnd = stat->getClk(true);
96
98 double phiStart = stat->getClk(true);
99 insertPHI(fun);
100 double phiEnd = stat->getClk(true);
102
104 double renameStart = stat->getClk(true);
105 SSARename(fun);
106 double renameEnd = stat->getClk(true);
108
109}
110
116{
117
118
119 DBOUT(DMSSA,
120 outs() << "\t creating mu chi for function " << fun.getName()
121 << "\n");
122 // 1. create mu/chi
123 // insert a set of mus for memory regions at each load
124 // inset a set of chis for memory regions at each store
125
126 // 2. find global names (region name before renaming) of each memory region,
127 // collect used mrs in usedRegs, and collect its def basic block in reg2BBMap
128 // in the form of mu(r) and r = chi (r)
129 // a) mu(r):
130 // if(r \not\in varKills) global = global \cup r
131 // b) r = chi(r):
132 // if(r \not\in varKills) global = global \cup r
133 // varKills = varKills \cup r
134 // block(r) = block(r) \cup bb_{chi}
135
138 BBList reachableBBs = fun.getReachableBBs();
139
140 for (BBList::const_iterator iter = reachableBBs.begin(), eiter = reachableBBs.end();
141 iter != eiter; ++iter)
142 {
143 const SVFBasicBlock* bb = *iter;
144 varKills.clear();
145 for (const auto& inst: bb->getICFGNodeList())
146 {
147 if(mrGen->hasSVFStmtList(inst))
148 {
150 for (SVFStmtList::const_iterator bit = pagEdgeList.begin(),
151 ebit = pagEdgeList.end(); bit != ebit; ++bit)
152 {
153 const PAGEdge* inst = *bit;
154 if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(inst))
155 AddLoadMU(bb, load, mrGen->getLoadMRSet(load));
156 else if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(inst))
157 AddStoreCHI(bb, store, mrGen->getStoreMRSet(store));
158 }
159 }
160 if (isNonInstricCallSite(inst))
161 {
162 const CallICFGNode* cs = cast<CallICFGNode>(inst);
163 if(mrGen->hasRefMRSet(cs))
165
166 if(mrGen->hasModMRSet(cs))
168 }
169 }
170 }
171
172 // create entry chi for this function including all memory regions
173 // initialize them with version 0 and 1 r_1 = chi (r_0)
174 for (MRSet::iterator iter = usedRegs.begin(), eiter = usedRegs.end();
175 iter != eiter; ++iter)
176 {
177 const MemRegion* mr = *iter;
178 // initialize mem region version and stack for renaming phase
179 mr2CounterMap[mr] = 0;
180 mr2VerStackMap[mr].clear();
181 ENTRYCHI* chi = new ENTRYCHI(&fun, mr);
182 chi->setOpVer(newSSAName(mr,chi));
183 chi->setResVer(newSSAName(mr,chi));
184 funToEntryChiSetMap[&fun].insert(chi);
185
188 if(fun.hasReturn())
189 {
190 RETMU* mu = new RETMU(&fun, mr);
191 funToReturnMuSetMap[&fun].insert(mu);
192 }
193
194 }
195
196}
197
198/*
199 * Insert phi node
200 */
202{
203
204 DBOUT(DMSSA,
205 outs() << "\t insert phi for function " << fun.getName() << "\n");
206
208 // record whether a phi of mr has already been inserted into the bb.
210
211 // start inserting phi node
212 for (MRSet::iterator iter = usedRegs.begin(), eiter = usedRegs.end();
213 iter != eiter; ++iter)
214 {
215 const MemRegion* mr = *iter;
216
217 BBList bbs = reg2BBMap[mr];
218 while (!bbs.empty())
219 {
220 const SVFBasicBlock* bb = bbs.back();
221 bbs.pop_back();
222 Map<const SVFBasicBlock*,Set<const SVFBasicBlock*>>::const_iterator it = df.find(bb);
223 if(it == df.end())
224 {
225 writeWrnMsg("bb not in the dominance frontier map??");
226 continue;
227 }
228 const Set<const SVFBasicBlock*>& domSet = it->second;
229 for (const SVFBasicBlock* pbb : domSet)
230 {
231 // if we never insert this phi node before
232 if (0 == bb2MRSetMap[pbb].count(mr))
233 {
234 bb2MRSetMap[pbb].insert(mr);
235 // insert phi node
236 AddMSSAPHI(pbb,mr);
237 // continue to insert phi in its iterative dominate frontiers
238 bbs.push_back(pbb);
239 }
240 }
241 }
242 }
243
244}
245
250{
251
252 DBOUT(DMSSA,
253 outs() << "\t ssa rename for function " << fun.getName() << "\n");
254
256}
257
263{
264
265 // record which mem region needs to pop stack
267
268 // rename phi result op
269 // for each r = phi (...)
270 // rewrite r as new name
271 if (hasPHISet(&bb))
273
274
275 // process mu and chi
276 // for each mu(r)
277 // rewrite r with top mrver of stack(r)
278 // for each r = chi(r')
279 // rewrite r' with top mrver of stack(r)
280 // rewrite r with new name
281
282 for (const auto& pNode: bb.getICFGNodeList())
283 {
285 {
287 for(SVFStmtList::const_iterator bit = pagEdgeList.begin(), ebit= pagEdgeList.end();
288 bit!=ebit; ++bit)
289 {
290 const PAGEdge* inst = *bit;
291 if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(inst))
292 RenameMuSet(getMUSet(load));
293
294 else if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(inst))
296
297 }
298 }
300 {
302 if(mrGen->hasRefMRSet(cs))
304
305 if(mrGen->hasModMRSet(cs))
307 }
308 else if(isRetInstNode(pNode))
309 {
310 const SVFFunction* fun = bb.getParent();
312 }
313 }
314
315
316 // fill phi operands of succ basic blocks
317 for (const SVFBasicBlock* succ : bb.getSuccessors())
318 {
320 if (hasPHISet(succ))
322 }
323
324 // for succ basic block in dominator tree
325 const SVFFunction* fun = bb.getParent();
327 Map<const SVFBasicBlock*,Set<const SVFBasicBlock*>>::const_iterator mapIter = dtBBsMap.find(&bb);
328 if (mapIter != dtBBsMap.end())
329 {
330 const Set<const SVFBasicBlock*>& dtBBs = mapIter->second;
331 for (const SVFBasicBlock* dtbb : dtBBs)
332 {
334 }
335 }
336 // for each r = chi(..), and r = phi(..)
337 // pop ver stack(r)
338 while (!memRegs.empty())
339 {
340 const MemRegion* mr = memRegs.back();
341 memRegs.pop_back();
342 mr2VerStackMap[mr].pop_back();
343 }
344
345}
346
348{
349 assert(0 != mr2CounterMap.count(mr)
350 && "did not find initial version in map? ");
351 assert(0 != mr2VerStackMap.count(mr)
352 && "did not find initial stack in map? ");
353
354 MRVERSION version = mr2CounterMap[mr];
355 mr2CounterMap[mr] = version + 1;
356 auto mrVer = std::make_unique<MRVer>(mr, version, def);
357 auto mrVerPtr = mrVer.get();
358 mr2VerStackMap[mr].push_back(mrVerPtr);
359 usedMRVers.push_back(std::move(mrVer));
360 return mrVerPtr;
361}
362
367{
368
369 for (LoadToMUSetMap::iterator iter = load2MuSetMap.begin(), eiter =
370 load2MuSetMap.end(); iter != eiter; ++iter)
371 {
372 for (MUSet::iterator it = iter->second.begin(), eit =
373 iter->second.end(); it != eit; ++it)
374 {
375 delete *it;
376 }
377 }
378
379 for (StoreToChiSetMap::iterator iter = store2ChiSetMap.begin(), eiter =
380 store2ChiSetMap.end(); iter != eiter; ++iter)
381 {
382 for (CHISet::iterator it = iter->second.begin(), eit =
383 iter->second.end(); it != eit; ++it)
384 {
385 delete *it;
386 }
387 }
388
389 for (CallSiteToMUSetMap::iterator iter = callsiteToMuSetMap.begin(),
390 eiter = callsiteToMuSetMap.end(); iter != eiter; ++iter)
391 {
392 for (MUSet::iterator it = iter->second.begin(), eit =
393 iter->second.end(); it != eit; ++it)
394 {
395 delete *it;
396 }
397 }
398
399 for (CallSiteToCHISetMap::iterator iter = callsiteToChiSetMap.begin(),
400 eiter = callsiteToChiSetMap.end(); iter != eiter; ++iter)
401 {
402 for (CHISet::iterator it = iter->second.begin(), eit =
403 iter->second.end(); it != eit; ++it)
404 {
405 delete *it;
406 }
407 }
408
409 for (FunToEntryChiSetMap::iterator iter = funToEntryChiSetMap.begin(),
410 eiter = funToEntryChiSetMap.end(); iter != eiter; ++iter)
411 {
412 for (CHISet::iterator it = iter->second.begin(), eit =
413 iter->second.end(); it != eit; ++it)
414 {
415 delete *it;
416 }
417 }
418
419 for (FunToReturnMuSetMap::iterator iter = funToReturnMuSetMap.begin(),
420 eiter = funToReturnMuSetMap.end(); iter != eiter; ++iter)
421 {
422 for (MUSet::iterator it = iter->second.begin(), eit =
423 iter->second.end(); it != eit; ++it)
424 {
425 delete *it;
426 }
427 }
428
429 for (BBToPhiSetMap::iterator iter = bb2PhiSetMap.begin(), eiter =
430 bb2PhiSetMap.end(); iter != eiter; ++iter)
431 {
432 for (PHISet::iterator it = iter->second.begin(), eit =
433 iter->second.end(); it != eit; ++it)
434 {
435 delete *it;
436 }
437 }
438
439 delete mrGen;
440 mrGen = nullptr;
441 delete stat;
442 stat = nullptr;
443 pta = nullptr;
444}
445
450{
451 if(pta->printStat())
452 stat->performStat();
453}
454
459{
460 u32_t num = 0;
461 LoadToMUSetMap::const_iterator it = load2MuSetMap.begin();
462 LoadToMUSetMap::const_iterator eit = load2MuSetMap.end();
463 for (; it != eit; it++)
464 {
465 const MUSet & muSet = it->second;
466 num+= muSet.size();
467 }
468 return num;
469}
470
471
476{
477 u32_t num = 0;
478 StoreToChiSetMap::const_iterator it = store2ChiSetMap.begin();
479 StoreToChiSetMap::const_iterator eit = store2ChiSetMap.end();
480 for (; it != eit; it++)
481 {
482 const CHISet& chiSet = it->second;
483 num += chiSet.size();
484 }
485 return num;
486}
487
488
493{
494 u32_t num = 0;
495 FunToEntryChiSetMap::const_iterator it = funToEntryChiSetMap.begin();
496 FunToEntryChiSetMap::const_iterator eit = funToEntryChiSetMap.end();
497 for (; it != eit; it++)
498 {
499 const CHISet& chiSet = it->second;
500 num += chiSet.size();
501 }
502 return num;
503}
504
505
510{
511 u32_t num = 0;
512 FunToReturnMuSetMap::const_iterator it = funToReturnMuSetMap.begin();
513 FunToReturnMuSetMap::const_iterator eit = funToReturnMuSetMap.end();
514 for (; it != eit; it++)
515 {
516 const MUSet & muSet = it->second;
517 num+= muSet.size();
518 }
519 return num;
520}
521
522
527{
528 u32_t num = 0;
529 CallSiteToMUSetMap::const_iterator it = callsiteToMuSetMap.begin();
530 CallSiteToMUSetMap::const_iterator eit = callsiteToMuSetMap.end();
531 for (; it != eit; it++)
532 {
533 const MUSet & muSet = it->second;
534 num+= muSet.size();
535 }
536 return num;
537}
538
539
544{
545 u32_t num = 0;
546 CallSiteToCHISetMap::const_iterator it = callsiteToChiSetMap.begin();
547 CallSiteToCHISetMap::const_iterator eit = callsiteToChiSetMap.end();
548 for (; it != eit; it++)
549 {
550 const CHISet & chiSet = it->second;
551 num+= chiSet.size();
552 }
553 return num;
554}
555
556
561{
562 u32_t num = 0;
563 BBToPhiSetMap::const_iterator it = bb2PhiSetMap.begin();
564 BBToPhiSetMap::const_iterator eit = bb2PhiSetMap.end();
565 for (; it != eit; it++)
566 {
567 const PHISet & phiSet = it->second;
568 num+= phiSet.size();
569 }
570 return num;
571}
572
577{
578
580 for (const auto& item: *svfirCallGraph)
581 {
582 const SVFFunction* fun = item.second->getFunction();
583 if(Options::MSSAFun()!="" && Options::MSSAFun()!=fun->getName())
584 continue;
585
586 Out << "==========FUNCTION: " << fun->getName() << "==========\n";
587 // dump function entry chi nodes
588 if (hasFuncEntryChi(fun))
589 {
591 for (CHISet::iterator chi_it = entry_chis.begin(); chi_it != entry_chis.end(); chi_it++)
592 {
593 (*chi_it)->dump();
594 }
595 }
596
597 for (SVFFunction::const_iterator bit = fun->begin(), ebit = fun->end();
598 bit != ebit; ++bit)
599 {
600 const SVFBasicBlock* bb = *bit;
601 Out << bb->getName() << "\n";
602 PHISet& phiSet = getPHISet(bb);
603 for(PHISet::iterator pi = phiSet.begin(), epi = phiSet.end(); pi !=epi; ++pi)
604 {
605 (*pi)->dump();
606 }
607
608 bool last_is_chi = false;
609 for (const auto& inst: bb->getICFGNodeList())
610 {
611 bool isAppCall = isNonInstricCallSite(inst) && !isExtCall(inst);
612 if (isAppCall || isHeapAllocExtCall(inst))
613 {
614 const CallICFGNode* cs = cast<CallICFGNode>(inst);
615 if(hasMU(cs))
616 {
617 if (!last_is_chi)
618 {
619 Out << "\n";
620 }
621 for (MUSet::iterator mit = getMUSet(cs).begin(), emit = getMUSet(cs).end();
622 mit != emit; ++mit)
623 {
624 (*mit)->dump();
625 }
626 }
627
628 Out << inst->toString() << "\n";
629
630 if(hasCHI(cs))
631 {
632 for (CHISet::iterator cit = getCHISet(cs).begin(), ecit = getCHISet(cs).end();
633 cit != ecit; ++cit)
634 {
635 (*cit)->dump();
636 }
637 Out << "\n";
638 last_is_chi = true;
639 }
640 else
641 last_is_chi = false;
642 }
643 else
644 {
645 bool dump_preamble = false;
647 for(SVFStmtList::const_iterator bit = pagEdgeList.begin(), ebit= pagEdgeList.end();
648 bit!=ebit; ++bit)
649 {
650 const PAGEdge* edge = *bit;
651 if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(edge))
652 {
653 MUSet& muSet = getMUSet(load);
654 for(MUSet::iterator it = muSet.begin(), eit = muSet.end(); it!=eit; ++it)
655 {
656 if (!dump_preamble && !last_is_chi)
657 {
658 Out << "\n";
659 dump_preamble = true;
660 }
661 (*it)->dump();
662 }
663 }
664 }
665
666 Out << inst->toString() << "\n";
667
668 bool has_chi = false;
669 for(SVFStmtList::const_iterator bit = pagEdgeList.begin(), ebit= pagEdgeList.end();
670 bit!=ebit; ++bit)
671 {
672 const PAGEdge* edge = *bit;
673 if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(edge))
674 {
675 CHISet& chiSet = getCHISet(store);
676 for(CHISet::iterator it = chiSet.begin(), eit = chiSet.end(); it!=eit; ++it)
677 {
678 has_chi = true;
679 (*it)->dump();
680 }
681 }
682 }
683 if (has_chi)
684 {
685 Out << "\n";
686 last_is_chi = true;
687 }
688 else
689 last_is_chi = false;
690 }
691 }
692 }
693
694 // dump return mu nodes
695 if (hasReturnMu(fun))
696 {
698 for (MUSet::iterator mu_it = return_mus.begin(); mu_it != return_mus.end(); mu_it++)
699 {
700 (*mu_it)->dump();
701 }
702 }
703 }
704}
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
Definition SVFType.h:484
#define TIMEINTERVAL
Definition SVFType.h:512
#define DMSSA
Definition SVFType.h:501
cJSON * p
Definition cJSON.cpp:2559
cJSON * item
Definition cJSON.h:222
int count
Definition cJSON.h:216
MRSet & getStoreMRSet(const StoreStmt *store)
Definition MemRegion.h:451
MRSet & getCallSiteRefMRSet(const CallICFGNode *cs)
Definition MemRegion.h:463
SVFStmtList & getPAGEdgesFromInst(const ICFGNode *node)
Given an instruction, get all its the PAGEdge (statement) in sequence.
virtual void generateMRs()
Start generating memory regions.
bool hasModMRSet(const CallICFGNode *cs)
Definition MemRegion.h:459
bool hasSVFStmtList(const ICFGNode *icfgNode)
Whether this instruction has SVFIR Edge.
MRSet & getLoadMRSet(const LoadStmt *load)
Definition MemRegion.h:447
MRSet & getCallSiteModMRSet(const CallICFGNode *cs)
Definition MemRegion.h:467
bool hasRefMRSet(const CallICFGNode *cs)
Definition MemRegion.h:455
Memory Region class.
Definition MemRegion.h:56
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:492
virtual void SSARename(const SVFFunction &fun)
SSA rename for a function.
Definition MemSSA.cpp:249
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
u32_t getCallSiteChiNum() const
Definition MemSSA.cpp:543
bool hasReturnMu(const SVFFunction *fun) const
Definition MemSSA.h:364
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:347
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
void destroy()
Release the memory.
Definition MemSSA.cpp:366
MUSet & getReturnMuSet(const SVFFunction *fun)
Definition MemSSA.h:373
SVFIR * getPAG()
Return SVFIR.
Definition MemSSA.cpp:72
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
virtual void buildMemSSA(const SVFFunction &fun)
We start from here.
Definition MemSSA.cpp:80
MemSSAStat * stat
Definition MemSSA.h:123
FunToEntryChiSetMap funToEntryChiSetMap
Definition MemSSA.h:140
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:509
virtual void createMUCHI(const SVFFunction &fun)
Create mu chi for candidate regions in a function.
Definition MemSSA.cpp:115
EntryCHI< Condition > ENTRYCHI
Definition MemSSA.h:64
MemSSA(BVDataPTAImpl *p, bool ptrOnlyMSSA)
Constructor.
Definition MemSSA.cpp:47
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:576
std::vector< const MemRegion * > MRVector
Definition MemSSA.h:76
Set< MU * > MUSet
Definition MemSSA.h:70
void performStat()
Perform statistics.
Definition MemSSA.cpp:449
Set< PHI * > PHISet
Definition MemSSA.h:72
void AddCallSiteMU(const CallICFGNode *cs, const MRSet &mrSet)
Definition MemSSA.h:199
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:560
u32_t getCallSiteMuNum() const
Definition MemSSA.cpp:526
u32_t getStoreChiNum() const
Definition MemSSA.cpp:475
u32_t getLoadMuNum() const
Stat methods.
Definition MemSSA.cpp:458
CallSiteToMUSetMap callsiteToMuSetMap
Definition MemSSA.h:136
FunToReturnMuSetMap funToReturnMuSetMap
Definition MemSSA.h:141
CHISet & getFuncEntryChiSet(const SVFFunction *fun)
Definition MemSSA.h:369
bool hasCHI(const PAGEdge *inst) const
Definition MemSSA.h:336
@ InterDisjoint
Definition MemSSA.h:117
@ IntraDisjoint
Definition MemSSA.h:116
virtual void insertPHI(const SVFFunction &fun)
Insert phi for candidate regions in a function.
Definition MemSSA.cpp:201
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
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:262
bool hasFuncEntryChi(const SVFFunction *fun) const
Has function entry chi or return mu.
Definition MemSSA.h:360
bool hasMU(const PAGEdge *inst) const
Has mu/chi methods.
Definition MemSSA.h:325
Set< CHI * > CHISet
Definition MemSSA.h:71
static const OptionMap< MemSSA::MemPartition > MemPar
Definition Options.h:145
static const Option< std::string > MSSAFun
Definition Options.h:143
@ Default_PTA
default pta without any analysis
bool printStat()
Whether print statistics.
SVFIR * getPAG() const
PTATY getAnalysisTy() const
Type of pointer analysis.
const SVFFunction * getParent() const
Definition SVFValue.h:595
const std::vector< const ICFGNode * > & getICFGNodeList() const
Definition SVFValue.h:580
const std::vector< const SVFBasicBlock * > & getSuccessors() const
Definition SVFValue.h:617
u32_t getBBPredecessorPos(const SVFBasicBlock *succbb)
Definition SVFValue.cpp:241
const ICFGNode * back() const
Definition SVFValue.h:611
const_iterator end() const
Definition SVFValue.h:451
const std::vector< const SVFBasicBlock * > & getReachableBBs() const
Definition SVFValue.h:461
const_iterator begin() const
Definition SVFValue.h:446
bool hasReturn() const
Definition SVFValue.h:471
std::vector< constSVFBasicBlock * >::const_iterator const_iterator
Definition SVFValue.h:305
const SVFBasicBlock * getEntryBlock() const
Definition SVFValue.h:420
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
Definition SVFValue.h:506
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
Definition SVFValue.h:501
CallGraph * getCallGraph()
Definition SVFIR.h:193
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition SVFIR.h:116
static double getClk(bool mark=false)
Definition SVFStat.cpp:48
const std::string & getName() const
Definition SVFValue.h:243
bool isExtCall(const SVFFunction *fun)
Definition SVFUtil.h:278
bool isHeapAllocExtCall(const ICFGNode *cs)
Definition SVFUtil.cpp:370
bool isNonInstricCallSite(const ICFGNode *inst)
Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls.
Definition SVFUtil.h:189
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
Definition SVFUtil.cpp:67
bool isRetInstNode(const ICFGNode *node)
Definition SVFUtil.cpp:389
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:50
for isBitcode
Definition BasicTypes.h:68
NodeID MRVERSION
Definition MemRegion.h:52
std::ostream OutStream
Definition GeneralType.h:45
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
unsigned u32_t
Definition GeneralType.h:46