svf-lib 1.0.2694 → 1.0.2695
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-osx/bin/ae +0 -0
- package/SVF-osx/bin/mta +0 -0
- package/SVF-osx/bin/svf-ex +0 -0
- package/SVF-osx/include/AE/Core/AbstractState.h +1 -1
- package/SVF-osx/include/AE/Core/AddressValue.h +3 -3
- package/SVF-osx/include/AE/Core/IntervalValue.h +64 -64
- package/SVF-osx/include/AE/Core/NumericValue.h +44 -44
- package/SVF-osx/include/AE/Svfexe/AEDetector.h +7 -7
- package/SVF-osx/include/DDA/FlowDDA.h +2 -2
- package/SVF-osx/include/Graphs/CDG.h +2 -2
- package/SVF-osx/include/Graphs/CHG.h +3 -3
- package/SVF-osx/include/Graphs/IRGraph.h +3 -3
- package/SVF-osx/include/Graphs/VFG.h +5 -5
- package/SVF-osx/include/Graphs/WTO.h +1 -1
- package/SVF-osx/include/MTA/LockAnalysis.h +8 -8
- package/SVF-osx/include/MTA/MTASVFGBuilder.h +1 -1
- package/SVF-osx/include/MemoryModel/AbstractPointsToDS.h +6 -0
- package/SVF-osx/include/MemoryModel/ConditionalPT.h +69 -69
- package/SVF-osx/include/MemoryModel/MutablePointsToDS.h +33 -33
- package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +18 -18
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +4 -0
- package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +4 -0
- package/SVF-osx/include/SABER/SaberCheckerAPI.h +2 -2
- package/SVF-osx/include/SVF-LLVM/GEPTypeBridgeIterator.h +11 -11
- package/SVF-osx/include/SVF-LLVM/LLVMModule.h +2 -2
- package/SVF-osx/include/SVFIR/SVFIR.h +3 -3
- package/SVF-osx/include/SVFIR/SVFVariables.h +1 -1
- package/SVF-osx/include/Util/CommandLine.h +10 -10
- package/SVF-osx/include/Util/SparseBitVector.h +30 -30
- package/SVF-osx/include/Util/iterator.h +15 -15
- package/SVF-osx/include/WPA/Andersen.h +10 -0
- package/SVF-osx/lib/libSvfCore.3.4.dylib +0 -0
- package/package.json +1 -1
|
@@ -261,13 +261,13 @@ public:
|
|
|
261
261
|
bool intersects(const CondStdSet<Element>& rhs) const
|
|
262
262
|
{
|
|
263
263
|
if (empty() && rhs.empty())
|
|
264
|
-
|
|
264
|
+
return false;
|
|
265
265
|
|
|
266
266
|
for (const_iterator i = rhs.begin(); i != rhs.end(); ++i)
|
|
267
267
|
{
|
|
268
268
|
if (elements.find(*i) != elements.end())
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
271
|
return false;
|
|
272
272
|
}
|
|
273
273
|
|
|
@@ -382,17 +382,17 @@ public:
|
|
|
382
382
|
inline unsigned numElement() const
|
|
383
383
|
{
|
|
384
384
|
if (_condPts.empty())
|
|
385
|
-
|
|
385
|
+
return 0;
|
|
386
386
|
else
|
|
387
387
|
{
|
|
388
388
|
unsigned num = 0;
|
|
389
389
|
for (CondPtsConstIter it = cptsBegin(); it != cptsEnd(); it++)
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
return num;
|
|
390
|
+
{
|
|
391
|
+
PointsTo pts = it->second;
|
|
392
|
+
num += pts.count();
|
|
395
393
|
}
|
|
394
|
+
return num;
|
|
395
|
+
}
|
|
396
396
|
}
|
|
397
397
|
/// Return true if no element in the set
|
|
398
398
|
inline bool empty() const
|
|
@@ -434,49 +434,49 @@ public:
|
|
|
434
434
|
inline bool aliased(const CondPointsToSet<Cond>& rhs) const
|
|
435
435
|
{
|
|
436
436
|
if (pointsTo().empty() || rhs.pointsTo().empty())
|
|
437
|
-
|
|
437
|
+
return false;
|
|
438
438
|
else
|
|
439
439
|
{
|
|
440
440
|
CondPtsConstIter lit = cptsBegin(), elit = cptsEnd();
|
|
441
|
-
|
|
441
|
+
for (; lit != elit; ++lit)
|
|
442
|
+
{
|
|
443
|
+
const Cond& lc = lit->first;
|
|
444
|
+
const PointsTo& pts = lit->second;
|
|
445
|
+
CondPtsConstIter rit = rhs.pointsTo().find(lc);
|
|
446
|
+
if(rit !=rhs.pointsTo().end())
|
|
442
447
|
{
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
if(rit !=rhs.pointsTo().end())
|
|
447
|
-
{
|
|
448
|
-
const PointsTo& rpts = rit->second;
|
|
449
|
-
if (pts.intersects(rpts))
|
|
450
|
-
return true;
|
|
451
|
-
}
|
|
448
|
+
const PointsTo& rpts = rit->second;
|
|
449
|
+
if (pts.intersects(rpts))
|
|
450
|
+
return true;
|
|
452
451
|
}
|
|
453
|
-
return false;
|
|
454
452
|
}
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
/// Check whether this CondPointsToSet is a subset of RHS
|
|
458
458
|
inline bool isSubset(const CondPointsToSet<Cond>& rhs) const
|
|
459
459
|
{
|
|
460
460
|
if (pointsTo().size() > rhs.pointsTo().size())
|
|
461
|
-
|
|
461
|
+
return false;
|
|
462
462
|
else
|
|
463
463
|
{
|
|
464
464
|
CondPtsConstIter lit = cptsBegin(), elit = cptsEnd();
|
|
465
|
-
|
|
465
|
+
for (; lit != elit; ++lit)
|
|
466
|
+
{
|
|
467
|
+
const Cond& lc = lit->first;
|
|
468
|
+
CondPtsConstIter rit = rhs.pointsTo().find(lc);
|
|
469
|
+
if (rit == rhs.pointsTo().end())
|
|
470
|
+
return false;
|
|
471
|
+
else
|
|
466
472
|
{
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
if (
|
|
473
|
+
const PointsTo& pts = lit->second;
|
|
474
|
+
const PointsTo& rpts = rit->second;
|
|
475
|
+
if (!rpts.contains(pts))
|
|
470
476
|
return false;
|
|
471
|
-
else
|
|
472
|
-
{
|
|
473
|
-
const PointsTo& pts = lit->second;
|
|
474
|
-
const PointsTo& rpts = rit->second;
|
|
475
|
-
if (!rpts.contains(pts))
|
|
476
|
-
return false;
|
|
477
|
-
}
|
|
478
477
|
}
|
|
479
478
|
}
|
|
479
|
+
}
|
|
480
480
|
return true;
|
|
481
481
|
}
|
|
482
482
|
|
|
@@ -485,20 +485,20 @@ public:
|
|
|
485
485
|
{
|
|
486
486
|
/// if either cpts is empty, just return.
|
|
487
487
|
if (pointsTo().empty() && rhs->pointsTo().empty())
|
|
488
|
-
|
|
488
|
+
return false;
|
|
489
489
|
|
|
490
490
|
CondPtsConstIter it = rhs->cptsBegin(), eit = rhs->cptsEnd();
|
|
491
491
|
for (; it != eit; ++it)
|
|
492
492
|
{
|
|
493
493
|
const Cond& cond = it->first;
|
|
494
494
|
if (hasPointsTo(cond))
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}
|
|
495
|
+
{
|
|
496
|
+
const PointsTo& rhs_pts= it->second;
|
|
497
|
+
const PointsTo& pts= pointsTo(cond);
|
|
498
|
+
if (pts.intersects(rhs_pts))
|
|
499
|
+
return true;
|
|
501
500
|
}
|
|
501
|
+
}
|
|
502
502
|
|
|
503
503
|
return false;
|
|
504
504
|
}
|
|
@@ -634,44 +634,44 @@ public:
|
|
|
634
634
|
inline bool operator< (const CondPointsToSet<Cond>& rhs) const
|
|
635
635
|
{
|
|
636
636
|
if (pointsTo().size() < rhs.pointsTo().size())
|
|
637
|
-
|
|
637
|
+
return true;
|
|
638
638
|
else if (pointsTo().size() == rhs.pointsTo().size())
|
|
639
639
|
{
|
|
640
640
|
CondPtsConstIter lit = cptsBegin(), elit = cptsEnd();
|
|
641
|
-
|
|
642
|
-
|
|
641
|
+
CondPtsConstIter rit = rhs.cptsBegin(), erit = rhs.cptsEnd();
|
|
642
|
+
for (; lit != elit && rit != erit; ++lit, ++rit)
|
|
643
|
+
{
|
|
644
|
+
const Cond& lc = lit->first;
|
|
645
|
+
const Cond& rc = rit->first;
|
|
646
|
+
if (lc < rc)
|
|
647
|
+
return true;
|
|
648
|
+
else if (lc == rc)
|
|
643
649
|
{
|
|
644
|
-
const
|
|
645
|
-
const
|
|
646
|
-
if (
|
|
650
|
+
const PointsTo& lpts = lit->second;
|
|
651
|
+
const PointsTo& rpts = rit->second;
|
|
652
|
+
if (lpts.count() < rpts.count())
|
|
647
653
|
return true;
|
|
648
|
-
else if (
|
|
654
|
+
else if (lpts.count() == rpts.count())
|
|
649
655
|
{
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
656
|
+
PointsTo::iterator bit = lpts.begin();
|
|
657
|
+
PointsTo::iterator eit = lpts.end();
|
|
658
|
+
PointsTo::iterator rbit = rpts.begin();
|
|
659
|
+
PointsTo::iterator reit = rpts.end();
|
|
660
|
+
for (; bit != eit && rbit != reit; bit++, rbit++)
|
|
655
661
|
{
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
for (; bit != eit && rbit != reit; bit++, rbit++)
|
|
661
|
-
{
|
|
662
|
-
if (*bit < *rbit)
|
|
663
|
-
return true;
|
|
664
|
-
else if (*bit > *rbit)
|
|
665
|
-
return false;
|
|
666
|
-
}
|
|
662
|
+
if (*bit < *rbit)
|
|
663
|
+
return true;
|
|
664
|
+
else if (*bit > *rbit)
|
|
665
|
+
return false;
|
|
667
666
|
}
|
|
668
|
-
else
|
|
669
|
-
return false;
|
|
670
667
|
}
|
|
671
668
|
else
|
|
672
669
|
return false;
|
|
673
670
|
}
|
|
671
|
+
else
|
|
672
|
+
return false;
|
|
674
673
|
}
|
|
674
|
+
}
|
|
675
675
|
return false;
|
|
676
676
|
}
|
|
677
677
|
|
|
@@ -685,8 +685,8 @@ public:
|
|
|
685
685
|
inline bool test(const SingleCondVar& var) const
|
|
686
686
|
{
|
|
687
687
|
if (hasPointsTo(var.get_cond()))
|
|
688
|
-
|
|
689
|
-
|
|
688
|
+
{
|
|
689
|
+
const PointsTo& pts = pointsTo(var.get_cond());
|
|
690
690
|
return pts.test(var.get_id());
|
|
691
691
|
}
|
|
692
692
|
return false;
|
|
@@ -763,11 +763,11 @@ private:
|
|
|
763
763
|
{
|
|
764
764
|
// If they are both at the end, ignore the rest of the fields.
|
|
765
765
|
if (atEnd && RHS.atEnd)
|
|
766
|
-
|
|
766
|
+
return true;
|
|
767
767
|
// Otherwise they are the same if they have the same condVar
|
|
768
768
|
return atEnd == RHS.atEnd && RHS._curIter == _curIter && RHS._ptIter == _ptIter;
|
|
769
769
|
}
|
|
770
|
-
|
|
770
|
+
bool operator!=(const CondPtsSetIterator &RHS) const
|
|
771
771
|
{
|
|
772
772
|
return !(*this == RHS);
|
|
773
773
|
}
|
|
@@ -128,10 +128,10 @@ public:
|
|
|
128
128
|
|
|
129
129
|
virtual void remapAllPts(void) override
|
|
130
130
|
{
|
|
131
|
-
for (typename PtsMap::value_type &ppt : ptsMap) ppt.second.checkAndRemap();
|
|
131
|
+
for (typename PtsMap::value_type &ppt : ptsMap) ppt.second.checkAndRemap();
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
virtual inline Map<DataSet, unsigned> getAllPts(bool liveOnly) const override
|
|
134
|
+
virtual inline Map<DataSet, unsigned> getAllPts(bool liveOnly) const override
|
|
135
135
|
{
|
|
136
136
|
Map<DataSet, unsigned> allPts;
|
|
137
137
|
for (typename PtsMap::value_type ppt : ptsMap)
|
|
@@ -286,11 +286,11 @@ public:
|
|
|
286
286
|
virtual void remapAllPts(void) override
|
|
287
287
|
{
|
|
288
288
|
mutPTData.remapAllPts();
|
|
289
|
-
for (typename PtsMap::value_type &ppt : diffPtsMap) ppt.second.checkAndRemap();
|
|
290
|
-
for (typename PtsMap::value_type &ppt : propaPtsMap) ppt.second.checkAndRemap();
|
|
291
|
-
|
|
289
|
+
for (typename PtsMap::value_type &ppt : diffPtsMap) ppt.second.checkAndRemap();
|
|
290
|
+
for (typename PtsMap::value_type &ppt : propaPtsMap) ppt.second.checkAndRemap();
|
|
291
|
+
}
|
|
292
292
|
|
|
293
|
-
virtual inline void dumpPTData() override
|
|
293
|
+
virtual inline void dumpPTData() override
|
|
294
294
|
{
|
|
295
295
|
mutPTData.dumpPTData();
|
|
296
296
|
}
|
|
@@ -545,14 +545,14 @@ public:
|
|
|
545
545
|
virtual void remapAllPts(void) override
|
|
546
546
|
{
|
|
547
547
|
mutPTData.remapAllPts();
|
|
548
|
-
for (typename DFPtsMap::value_type &lopt : dfInPtsMap)
|
|
549
|
-
|
|
550
|
-
|
|
548
|
+
for (typename DFPtsMap::value_type &lopt : dfInPtsMap)
|
|
549
|
+
{
|
|
550
|
+
for (typename PtsMap::value_type &opt : lopt.second) opt.second.checkAndRemap();
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
for (typename DFPtsMap::value_type &lopt : dfOutPtsMap)
|
|
554
|
-
|
|
555
|
-
|
|
553
|
+
for (typename DFPtsMap::value_type &lopt : dfOutPtsMap)
|
|
554
|
+
{
|
|
555
|
+
for (typename PtsMap::value_type &opt : lopt.second) opt.second.checkAndRemap();
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
///@}
|
|
@@ -616,9 +616,9 @@ public:
|
|
|
616
616
|
std::error_code ErrInfo;
|
|
617
617
|
std::fstream f("svfg_pts.data", std::ios_base::out);
|
|
618
618
|
if (f.good())
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
619
|
+
{
|
|
620
|
+
NodeBS locs;
|
|
621
|
+
for(DFPtsMapconstIter it = dfInPtsMap.begin(), eit = dfInPtsMap.end(); it!=eit; ++it)
|
|
622
622
|
locs.set(it->first);
|
|
623
623
|
|
|
624
624
|
for(DFPtsMapconstIter it = dfOutPtsMap.begin(), eit = dfOutPtsMap.end(); it!=eit; ++it)
|
|
@@ -706,9 +706,9 @@ public:
|
|
|
706
706
|
virtual inline bool updateDFInFromIn(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
707
707
|
{
|
|
708
708
|
if(varHasNewDFInPts(srcLoc, srcVar) &&
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
709
|
+
this->unionPts(this->getDFInPtsSet(dstLoc,dstVar), this->getDFInPtsSet(srcLoc,srcVar)))
|
|
710
|
+
{
|
|
711
|
+
setVarDFInSetUpdated(dstLoc,dstVar);
|
|
712
712
|
return true;
|
|
713
713
|
}
|
|
714
714
|
return false;
|
|
@@ -717,9 +717,9 @@ public:
|
|
|
717
717
|
virtual inline bool updateDFInFromOut(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
718
718
|
{
|
|
719
719
|
if(varHasNewDFOutPts(srcLoc, srcVar) &&
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
720
|
+
this->unionPts(this->getDFInPtsSet(dstLoc,dstVar), this->getDFOutPtsSet(srcLoc,srcVar)))
|
|
721
|
+
{
|
|
722
|
+
setVarDFInSetUpdated(dstLoc,dstVar);
|
|
723
723
|
return true;
|
|
724
724
|
}
|
|
725
725
|
return false;
|
|
@@ -728,8 +728,8 @@ public:
|
|
|
728
728
|
virtual inline bool updateDFOutFromIn(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
729
729
|
{
|
|
730
730
|
if(varHasNewDFInPts(srcLoc,srcVar))
|
|
731
|
-
|
|
732
|
-
|
|
731
|
+
{
|
|
732
|
+
removeVarFromDFInUpdatedSet(srcLoc,srcVar);
|
|
733
733
|
if (this->unionPts(this->getDFOutPtsSet(dstLoc,dstVar), this->getDFInPtsSet(srcLoc,srcVar)))
|
|
734
734
|
{
|
|
735
735
|
setVarDFOutSetUpdated(dstLoc,dstVar);
|
|
@@ -742,8 +742,8 @@ public:
|
|
|
742
742
|
virtual inline bool updateAllDFInFromOut(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
743
743
|
{
|
|
744
744
|
if(this->unionPts(this->getDFInPtsSet(dstLoc,dstVar), this->getDFOutPtsSet(srcLoc,srcVar)))
|
|
745
|
-
|
|
746
|
-
|
|
745
|
+
{
|
|
746
|
+
setVarDFInSetUpdated(dstLoc,dstVar);
|
|
747
747
|
return true;
|
|
748
748
|
}
|
|
749
749
|
return false;
|
|
@@ -752,8 +752,8 @@ public:
|
|
|
752
752
|
virtual inline bool updateAllDFInFromIn(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
753
753
|
{
|
|
754
754
|
if(this->unionPts(this->getDFInPtsSet(dstLoc,dstVar), this->getDFInPtsSet(srcLoc,srcVar)))
|
|
755
|
-
|
|
756
|
-
|
|
755
|
+
{
|
|
756
|
+
setVarDFInSetUpdated(dstLoc,dstVar);
|
|
757
757
|
return true;
|
|
758
758
|
}
|
|
759
759
|
return false;
|
|
@@ -782,8 +782,8 @@ public:
|
|
|
782
782
|
virtual inline bool updateTLVPts(LocID srcLoc, const Key& srcVar, const Key& dstVar) override
|
|
783
783
|
{
|
|
784
784
|
if(varHasNewDFInPts(srcLoc,srcVar))
|
|
785
|
-
|
|
786
|
-
|
|
785
|
+
{
|
|
786
|
+
removeVarFromDFInUpdatedSet(srcLoc,srcVar);
|
|
787
787
|
return this->mutPTData.unionPts(dstVar, this->getDFInPtsSet(srcLoc,srcVar));
|
|
788
788
|
}
|
|
789
789
|
return false;
|
|
@@ -792,8 +792,8 @@ public:
|
|
|
792
792
|
virtual inline bool updateATVPts(const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
793
793
|
{
|
|
794
794
|
if (this->unionPts(this->getDFOutPtsSet(dstLoc, dstVar), this->mutPTData.getPts(srcVar)))
|
|
795
|
-
|
|
796
|
-
|
|
795
|
+
{
|
|
796
|
+
setVarDFOutSetUpdated(dstLoc, dstVar);
|
|
797
797
|
return true;
|
|
798
798
|
}
|
|
799
799
|
return false;
|
|
@@ -802,8 +802,8 @@ public:
|
|
|
802
802
|
virtual inline void clearAllDFOutUpdatedVar(LocID loc) override
|
|
803
803
|
{
|
|
804
804
|
if (this->hasDFOutSet(loc))
|
|
805
|
-
|
|
806
|
-
|
|
805
|
+
{
|
|
806
|
+
DataSet pts = getDFOutUpdatedVar(loc);
|
|
807
807
|
for (DataIter ptsIt = pts.begin(), ptsEit = pts.end(); ptsIt != ptsEit; ++ptsIt)
|
|
808
808
|
{
|
|
809
809
|
const Key var = *ptsIt;
|
|
@@ -598,9 +598,9 @@ public:
|
|
|
598
598
|
inline bool updateDFInFromIn(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
599
599
|
{
|
|
600
600
|
if (varHasNewDFInPts(srcLoc, srcVar)
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
601
|
+
&& this->unionPtsThroughIds(this->getDFInPtIdRef(dstLoc, dstVar), this->getDFInPtIdRef(srcLoc, srcVar)))
|
|
602
|
+
{
|
|
603
|
+
setVarDFInSetUpdated(dstLoc, dstVar);
|
|
604
604
|
return true;
|
|
605
605
|
}
|
|
606
606
|
|
|
@@ -610,9 +610,9 @@ public:
|
|
|
610
610
|
inline bool updateDFInFromOut(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
611
611
|
{
|
|
612
612
|
if (varHasNewDFOutPts(srcLoc, srcVar)
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
613
|
+
&& this->unionPtsThroughIds(this->getDFInPtIdRef(dstLoc, dstVar), this->getDFOutPtIdRef(srcLoc, srcVar)))
|
|
614
|
+
{
|
|
615
|
+
setVarDFInSetUpdated(dstLoc, dstVar);
|
|
616
616
|
return true;
|
|
617
617
|
}
|
|
618
618
|
|
|
@@ -622,8 +622,8 @@ public:
|
|
|
622
622
|
inline bool updateDFOutFromIn(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
623
623
|
{
|
|
624
624
|
if (varHasNewDFInPts(srcLoc, srcVar))
|
|
625
|
-
|
|
626
|
-
|
|
625
|
+
{
|
|
626
|
+
removeVarFromDFInUpdatedSet(srcLoc, srcVar);
|
|
627
627
|
if (this->unionPtsThroughIds(this->getDFOutPtIdRef(dstLoc, dstVar), this->getDFInPtIdRef(srcLoc, srcVar)))
|
|
628
628
|
{
|
|
629
629
|
setVarDFOutSetUpdated(dstLoc, dstVar);
|
|
@@ -637,8 +637,8 @@ public:
|
|
|
637
637
|
inline bool updateAllDFInFromOut(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
638
638
|
{
|
|
639
639
|
if (this->unionPtsThroughIds(this->getDFInPtIdRef(dstLoc, dstVar), this->getDFOutPtIdRef(srcLoc, srcVar)))
|
|
640
|
-
|
|
641
|
-
|
|
640
|
+
{
|
|
641
|
+
setVarDFInSetUpdated(dstLoc, dstVar);
|
|
642
642
|
return true;
|
|
643
643
|
}
|
|
644
644
|
|
|
@@ -648,8 +648,8 @@ public:
|
|
|
648
648
|
inline bool updateAllDFInFromIn(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
649
649
|
{
|
|
650
650
|
if (this->unionPtsThroughIds(this->getDFInPtIdRef(dstLoc, dstVar), this->getDFInPtIdRef(srcLoc, srcVar)))
|
|
651
|
-
|
|
652
|
-
|
|
651
|
+
{
|
|
652
|
+
setVarDFInSetUpdated(dstLoc, dstVar);
|
|
653
653
|
return true;
|
|
654
654
|
}
|
|
655
655
|
|
|
@@ -677,8 +677,8 @@ public:
|
|
|
677
677
|
inline bool updateTLVPts(LocID srcLoc, const Key& srcVar, const Key& dstVar) override
|
|
678
678
|
{
|
|
679
679
|
if (varHasNewDFInPts(srcLoc, srcVar))
|
|
680
|
-
|
|
681
|
-
|
|
680
|
+
{
|
|
681
|
+
removeVarFromDFInUpdatedSet(srcLoc, srcVar);
|
|
682
682
|
return this->unionPtsThroughIds(this->persPTData.ptsMap[dstVar], this->getDFInPtIdRef(srcLoc, srcVar));
|
|
683
683
|
}
|
|
684
684
|
|
|
@@ -688,8 +688,8 @@ public:
|
|
|
688
688
|
inline bool updateATVPts(const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
689
689
|
{
|
|
690
690
|
if (this->unionPtsThroughIds(this->getDFOutPtIdRef(dstLoc, dstVar), this->persPTData.ptsMap[srcVar]))
|
|
691
|
-
|
|
692
|
-
|
|
691
|
+
{
|
|
692
|
+
setVarDFOutSetUpdated(dstLoc, dstVar);
|
|
693
693
|
return true;
|
|
694
694
|
}
|
|
695
695
|
|
|
@@ -699,8 +699,8 @@ public:
|
|
|
699
699
|
inline void clearAllDFOutUpdatedVar(LocID loc) override
|
|
700
700
|
{
|
|
701
701
|
if (this->hasDFOutSet(loc))
|
|
702
|
-
|
|
703
|
-
|
|
702
|
+
{
|
|
703
|
+
const KeySet vars = getDFOutUpdatedVar(loc);
|
|
704
704
|
for (const Key &var : vars)
|
|
705
705
|
{
|
|
706
706
|
removeVarFromDFOutUpdatedSet(loc, var);
|
|
@@ -189,6 +189,10 @@ public:
|
|
|
189
189
|
/// Interface exposed to users of our pointer analysis, given PAGNodeID
|
|
190
190
|
virtual AliasResult alias(NodeID node1, NodeID node2) = 0;
|
|
191
191
|
|
|
192
|
+
/// Collect the nodes that may alias the given node.
|
|
193
|
+
/// Subclasses must implement this query; the default reports unsupported and aborts.
|
|
194
|
+
virtual NodeBS getMayAliases(NodeID node);
|
|
195
|
+
|
|
192
196
|
/// Get points-to targets of a pointer. It needs to be implemented in child class
|
|
193
197
|
virtual const PointsTo& getPts(NodeID ptr) = 0;
|
|
194
198
|
|
|
@@ -225,6 +225,10 @@ public:
|
|
|
225
225
|
/// Interface expose to users of our pointer analysis, given two pts
|
|
226
226
|
virtual AliasResult alias(const PointsTo& pts1, const PointsTo& pts2);
|
|
227
227
|
|
|
228
|
+
/// Declaring the PointsTo overload below would otherwise hide the base class's
|
|
229
|
+
/// mayAlias(NodeID, NodeID) and mayAlias(const SVFVar*, const SVFVar*).
|
|
230
|
+
using PointerAnalysis::mayAlias;
|
|
231
|
+
|
|
228
232
|
/// Convenience bool wrappers: return true if the two operands may/must/partial alias
|
|
229
233
|
inline bool mayAlias(const PointsTo& pts1, const PointsTo& pts2)
|
|
230
234
|
{
|
|
@@ -76,8 +76,8 @@ private:
|
|
|
76
76
|
inline CHECKER_TYPE getType(const FunObjVar* F) const
|
|
77
77
|
{
|
|
78
78
|
if(F)
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
{
|
|
80
|
+
TDAPIMap::const_iterator it= tdAPIMap.find(F->getName());
|
|
81
81
|
if(it != tdAPIMap.end())
|
|
82
82
|
return it->second;
|
|
83
83
|
}
|
|
@@ -67,34 +67,34 @@ public:
|
|
|
67
67
|
Type* operator*() const
|
|
68
68
|
{
|
|
69
69
|
if ( CurTy.getInt() )
|
|
70
|
-
|
|
70
|
+
return PointerType::get(CurTy.getPointer()->getContext(), AddrSpace);
|
|
71
71
|
return CurTy.getPointer();
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
Type* getIndexedType() const
|
|
74
|
+
Type* getIndexedType() const
|
|
75
75
|
{
|
|
76
76
|
assert(false && "needs to be refactored");
|
|
77
77
|
if ( CurTy.getInt() )
|
|
78
|
-
|
|
78
|
+
return CurTy.getPointer();
|
|
79
79
|
#if LLVM_VERSION_MAJOR >= 11
|
|
80
80
|
Type* CT = CurTy.getPointer();
|
|
81
81
|
if (auto ST = dyn_cast<StructType>(CT))
|
|
82
82
|
return ST->getTypeAtIndex(getOperand());
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
else if (auto Array = dyn_cast<ArrayType>(CT))
|
|
84
|
+
return Array->getElementType();
|
|
85
|
+
else if (auto Vector = dyn_cast<VectorType>(CT))
|
|
86
|
+
return Vector->getElementType();
|
|
87
|
+
else
|
|
88
|
+
return CT;
|
|
89
89
|
#else
|
|
90
90
|
CompositeType *CT = llvm::cast<CompositeType>( CurTy.getPointer() );
|
|
91
91
|
return CT->getTypeAtIndex(getOperand());
|
|
92
92
|
#endif
|
|
93
|
-
|
|
93
|
+
}
|
|
94
94
|
|
|
95
95
|
// non-standard operators, these may not need be bridged but seems it's
|
|
96
96
|
// prudent to do so...
|
|
97
|
-
Type* operator->() const
|
|
97
|
+
Type* operator->() const
|
|
98
98
|
{
|
|
99
99
|
return operator*();
|
|
100
100
|
}
|
|
@@ -370,8 +370,8 @@ public:
|
|
|
370
370
|
{
|
|
371
371
|
assert(!empty() && "empty LLVM module!!");
|
|
372
372
|
for (size_t i = 0; i < getModuleNum(); ++i)
|
|
373
|
-
|
|
374
|
-
|
|
373
|
+
{
|
|
374
|
+
Module& module = getModuleRef(i);
|
|
375
375
|
if (module.getName().str() != ExtAPI::getExtAPI()->getExtBcPath())
|
|
376
376
|
{
|
|
377
377
|
return &module;
|
|
@@ -261,9 +261,9 @@ public:
|
|
|
261
261
|
inline const std::string& getModuleIdentifier() const
|
|
262
262
|
{
|
|
263
263
|
if (pagReadFromTxt.empty())
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
264
|
+
{
|
|
265
|
+
assert(!moduleIdentifier.empty() &&
|
|
266
|
+
"No module found! Reading from a file other than LLVM-IR?");
|
|
267
267
|
return moduleIdentifier;
|
|
268
268
|
}
|
|
269
269
|
else
|
|
@@ -430,10 +430,10 @@ public:
|
|
|
430
430
|
|
|
431
431
|
virtual bool parseAndSetValue(const std::string s) override
|
|
432
432
|
{
|
|
433
|
-
for (const OptionPossibility<T> &op : possibilities)
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
433
|
+
for (const OptionPossibility<T> &op : possibilities)
|
|
434
|
+
{
|
|
435
|
+
// Check if the given string is a valid one.
|
|
436
|
+
if (s == std::get<1>(op))
|
|
437
437
|
{
|
|
438
438
|
// What that string maps to.
|
|
439
439
|
value = std::get<0>(op);
|
|
@@ -487,9 +487,9 @@ public:
|
|
|
487
487
|
virtual bool parseAndSetValue(const std::string s) override
|
|
488
488
|
{
|
|
489
489
|
// Like in OptionMap basically, except we can have many values.
|
|
490
|
-
for (const OptionPossibility<T> &op : possibilities)
|
|
491
|
-
|
|
492
|
-
|
|
490
|
+
for (const OptionPossibility<T> &op : possibilities)
|
|
491
|
+
{
|
|
492
|
+
if (s == std::get<1>(op))
|
|
493
493
|
{
|
|
494
494
|
optionValues[std::get<0>(op)] = true;
|
|
495
495
|
return true;
|
|
@@ -507,9 +507,9 @@ for (const OptionPossibility<T> &op : possibilities)
|
|
|
507
507
|
/// If the bitset is empty.
|
|
508
508
|
bool nothingSet(void) const
|
|
509
509
|
{
|
|
510
|
-
for (const std::pair<T, bool> tb : optionValues)
|
|
511
|
-
|
|
512
|
-
|
|
510
|
+
for (const std::pair<T, bool> tb : optionValues)
|
|
511
|
+
{
|
|
512
|
+
if (tb.second) return false;
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
return true;
|