svf-lib 1.0.882 → 1.0.886
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-linux/Release-build/lib/libSvf.a +0 -0
- package/SVF-linux/include/DDA/DDAPass.h +2 -14
- package/SVF-linux/include/Graphs/GraphPrinter.h +2 -2
- package/SVF-linux/include/Graphs/ICFGEdge.h +1 -1
- package/SVF-linux/include/Graphs/ICFGNode.h +1 -1
- package/SVF-linux/include/Graphs/ICFGStat.h +4 -4
- package/SVF-linux/include/Graphs/PTACallGraph.h +2 -2
- package/SVF-linux/include/Graphs/VFG.h +1 -1
- package/SVF-linux/include/Graphs/VFGEdge.h +1 -1
- package/SVF-linux/include/Graphs/VFGNode.h +1 -1
- package/SVF-linux/include/MSSA/MemSSA.h +1 -1
- package/SVF-linux/include/MTA/MTA.h +0 -8
- package/SVF-linux/include/MemoryModel/ConditionalPT.h +2 -3
- package/SVF-linux/include/MemoryModel/MutablePointsToDS.h +14 -15
- package/SVF-linux/include/MemoryModel/PersistentPointsToCache.h +19 -19
- package/SVF-linux/include/MemoryModel/PointerAnalysis.h +1 -1
- package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +5 -5
- package/SVF-linux/include/MemoryModel/SVFStatements.h +1 -1
- package/SVF-linux/include/MemoryModel/SVFVariables.h +1 -1
- package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +0 -6
- package/SVF-linux/include/SABER/SaberCheckerAPI.h +1 -1
- package/SVF-linux/include/SVF-FE/BasicTypes.h +19 -0
- package/SVF-linux/include/SVF-FE/BreakConstantExpr.h +0 -11
- package/SVF-linux/include/SVF-FE/DataFlowUtil.h +0 -6
- package/SVF-linux/include/SVF-FE/LLVMUtil.h +15 -5
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +1 -0
- package/SVF-linux/include/Util/BasicTypes.h +1 -15
- package/SVF-linux/include/Util/Conditions.h +1 -1
- package/SVF-linux/include/Util/CxtStmt.h +7 -3
- package/SVF-linux/include/Util/DPItem.h +0 -1
- package/SVF-linux/include/Util/ExtAPI.h +4 -2
- package/SVF-linux/include/Util/IRAnnotator.h +2 -2
- package/SVF-linux/include/Util/SVFBasicTypes.h +21 -3
- package/SVF-linux/include/Util/SVFUtil.h +7 -7
- package/SVF-linux/include/Util/ThreadAPI.h +1 -1
- package/SVF-linux/include/WPA/WPAPass.h +2 -16
- package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/DDA/DDAPass.h +2 -14
- package/SVF-osx/include/Graphs/GraphPrinter.h +2 -2
- package/SVF-osx/include/Graphs/ICFGEdge.h +1 -1
- package/SVF-osx/include/Graphs/ICFGNode.h +1 -1
- package/SVF-osx/include/Graphs/ICFGStat.h +4 -4
- package/SVF-osx/include/Graphs/PTACallGraph.h +2 -2
- package/SVF-osx/include/Graphs/VFG.h +1 -1
- package/SVF-osx/include/Graphs/VFGEdge.h +1 -1
- package/SVF-osx/include/Graphs/VFGNode.h +1 -1
- package/SVF-osx/include/MSSA/MemSSA.h +1 -1
- package/SVF-osx/include/MTA/MTA.h +0 -8
- package/SVF-osx/include/MemoryModel/ConditionalPT.h +2 -3
- package/SVF-osx/include/MemoryModel/MutablePointsToDS.h +14 -15
- package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +19 -19
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +1 -1
- package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +5 -5
- package/SVF-osx/include/MemoryModel/SVFStatements.h +1 -1
- package/SVF-osx/include/MemoryModel/SVFVariables.h +1 -1
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +0 -6
- package/SVF-osx/include/SABER/SaberCheckerAPI.h +1 -1
- package/SVF-osx/include/SVF-FE/BasicTypes.h +19 -0
- package/SVF-osx/include/SVF-FE/BreakConstantExpr.h +0 -11
- package/SVF-osx/include/SVF-FE/DataFlowUtil.h +0 -6
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +15 -5
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +1 -0
- package/SVF-osx/include/Util/BasicTypes.h +1 -15
- package/SVF-osx/include/Util/Conditions.h +1 -1
- package/SVF-osx/include/Util/CxtStmt.h +7 -3
- package/SVF-osx/include/Util/DPItem.h +0 -1
- package/SVF-osx/include/Util/ExtAPI.h +5 -2
- package/SVF-osx/include/Util/IRAnnotator.h +2 -2
- package/SVF-osx/include/Util/SVFBasicTypes.h +21 -3
- package/SVF-osx/include/Util/SVFUtil.h +7 -7
- package/SVF-osx/include/Util/ThreadAPI.h +1 -1
- package/SVF-osx/include/WPA/WPAPass.h +2 -16
- package/package.json +1 -1
|
Binary file
|
|
@@ -21,7 +21,7 @@ namespace SVF
|
|
|
21
21
|
* Demand-Driven Pointer Analysis.
|
|
22
22
|
* This class performs various pointer analysis on the given module.
|
|
23
23
|
*/
|
|
24
|
-
class DDAPass
|
|
24
|
+
class DDAPass
|
|
25
25
|
{
|
|
26
26
|
|
|
27
27
|
public:
|
|
@@ -31,21 +31,9 @@ public:
|
|
|
31
31
|
typedef OrderedSet<const SVFGEdge*> SVFGEdgeSet;
|
|
32
32
|
typedef std::vector<PointerAnalysis*> PTAVector;
|
|
33
33
|
|
|
34
|
-
DDAPass() :
|
|
34
|
+
DDAPass() : _pta(nullptr), _client(nullptr) {}
|
|
35
35
|
~DDAPass();
|
|
36
36
|
|
|
37
|
-
virtual inline void getAnalysisUsage(AnalysisUsage &au) const
|
|
38
|
-
{
|
|
39
|
-
// declare your dependencies here.
|
|
40
|
-
/// do not intend to change the IR in this pass,
|
|
41
|
-
au.setPreservesAll();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
virtual inline void* getAdjustedAnalysisPointer(AnalysisID)
|
|
45
|
-
{
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
37
|
/// Interface expose to users of our pointer analysis, given Location infos
|
|
50
38
|
virtual inline AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
|
|
51
39
|
{
|
|
@@ -54,7 +54,7 @@ public:
|
|
|
54
54
|
* Write the graph into dot file for debugging purpose
|
|
55
55
|
*/
|
|
56
56
|
template<class GraphType>
|
|
57
|
-
static void WriteGraphToFile(
|
|
57
|
+
static void WriteGraphToFile(SVF::OutStream &O,
|
|
58
58
|
const std::string &GraphName, const GraphType >, bool simple = false)
|
|
59
59
|
{
|
|
60
60
|
// Filename of the output dot file
|
|
@@ -83,7 +83,7 @@ public:
|
|
|
83
83
|
* Print the graph to command line
|
|
84
84
|
*/
|
|
85
85
|
template<class GraphType>
|
|
86
|
-
static void PrintGraph(
|
|
86
|
+
static void PrintGraph(SVF::OutStream &O, const std::string &GraphName,
|
|
87
87
|
const GraphType >)
|
|
88
88
|
{
|
|
89
89
|
///Define the GTraits and node iterator for printing
|
|
@@ -96,7 +96,7 @@ public:
|
|
|
96
96
|
|
|
97
97
|
/// Overloading operator << for dumping ICFG node ID
|
|
98
98
|
//@{
|
|
99
|
-
friend
|
|
99
|
+
friend OutStream& operator<< (OutStream &o, const ICFGEdge &edge)
|
|
100
100
|
{
|
|
101
101
|
o << edge.toString();
|
|
102
102
|
return o;
|
|
@@ -145,16 +145,16 @@ public:
|
|
|
145
145
|
void printStat(string statname)
|
|
146
146
|
{
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
SVFUtil::outs() << "\n************ " << statname << " ***************\n";
|
|
149
|
+
SVFUtil::outs().flags(std::ios::left);
|
|
150
150
|
unsigned field_width = 20;
|
|
151
151
|
for(NUMStatMap::iterator it = PTNumStatMap.begin(), eit = PTNumStatMap.end(); it!=eit; ++it)
|
|
152
152
|
{
|
|
153
153
|
// format out put with width 20 space
|
|
154
|
-
|
|
154
|
+
SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
|
|
155
155
|
}
|
|
156
156
|
PTNumStatMap.clear();
|
|
157
|
-
|
|
157
|
+
SVFUtil::outs().flush();
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
|
|
@@ -154,7 +154,7 @@ public:
|
|
|
154
154
|
|
|
155
155
|
/// Overloading operator << for dumping ICFG node ID
|
|
156
156
|
//@{
|
|
157
|
-
friend
|
|
157
|
+
friend OutStream& operator<< (OutStream &o, const PTACallGraphEdge &edge)
|
|
158
158
|
{
|
|
159
159
|
o << edge.toString();
|
|
160
160
|
return o;
|
|
@@ -201,7 +201,7 @@ public:
|
|
|
201
201
|
|
|
202
202
|
/// Overloading operator << for dumping ICFG node ID
|
|
203
203
|
//@{
|
|
204
|
-
friend
|
|
204
|
+
friend OutStream& operator<< (OutStream &o, const PTACallGraphNode &node)
|
|
205
205
|
{
|
|
206
206
|
o << node.toString();
|
|
207
207
|
return o;
|
|
@@ -555,7 +555,7 @@ protected:
|
|
|
555
555
|
/// we will set this phi node's def later
|
|
556
556
|
/// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
|
|
557
557
|
if (!pag->isPhiNode(uniqueFunRet)){
|
|
558
|
-
std::string warn = fun->getName()
|
|
558
|
+
std::string warn = fun->getName();
|
|
559
559
|
SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
|
|
560
560
|
setDef(uniqueFunRet, sNode);
|
|
561
561
|
}
|
|
@@ -124,7 +124,7 @@ public:
|
|
|
124
124
|
|
|
125
125
|
/// Overloading operator << for dumping ICFG node ID
|
|
126
126
|
//@{
|
|
127
|
-
friend
|
|
127
|
+
friend OutStream& operator<< (OutStream &o, const VFGEdge &edge)
|
|
128
128
|
{
|
|
129
129
|
o << edge.toString();
|
|
130
130
|
return o;
|
|
@@ -68,14 +68,6 @@ public:
|
|
|
68
68
|
|
|
69
69
|
void dump(Module &module, MHP *mhp, LockAnalysis *lsa);
|
|
70
70
|
|
|
71
|
-
/// Get analysis usage
|
|
72
|
-
inline virtual void getAnalysisUsage(AnalysisUsage& au) const
|
|
73
|
-
{
|
|
74
|
-
/// do not intend to change the IR in this pass,
|
|
75
|
-
au.setPreservesAll();
|
|
76
|
-
au.addRequired<ScalarEvolutionWrapperPass>();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
71
|
// Get ScalarEvolution for Function F.
|
|
80
72
|
static inline ScalarEvolution* getSE(const Function *F)
|
|
81
73
|
{
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
#define CONDVAR_H_
|
|
32
32
|
|
|
33
33
|
#include "Util/SVFUtil.h"
|
|
34
|
-
#include "llvm/Support/raw_ostream.h"
|
|
35
34
|
#include "MemoryModel/PointsTo.h"
|
|
36
35
|
|
|
37
36
|
namespace SVF
|
|
@@ -114,7 +113,7 @@ public:
|
|
|
114
113
|
return rawstr.str();
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
friend
|
|
116
|
+
friend OutStream& operator<< (OutStream &o, const CondVar<Cond> &cvar)
|
|
118
117
|
{
|
|
119
118
|
o << cvar.toString();
|
|
120
119
|
return o;
|
|
@@ -708,7 +707,7 @@ public:
|
|
|
708
707
|
|
|
709
708
|
// Print all points-to targets
|
|
710
709
|
//@{
|
|
711
|
-
inline void dump(
|
|
710
|
+
inline void dump(OutStream & O) const
|
|
712
711
|
{
|
|
713
712
|
CondPtsConstIter it = cptsBegin();
|
|
714
713
|
CondPtsConstIter eit = cptsEnd();
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
#ifndef MUTABLE_POINTSTO_H_
|
|
5
5
|
#define MUTABLE_POINTSTO_H_
|
|
6
6
|
|
|
7
|
+
#include<fstream>
|
|
8
|
+
|
|
7
9
|
#include "MemoryModel/AbstractPointsToDS.h"
|
|
8
10
|
#include "Util/SVFBasicTypes.h"
|
|
9
11
|
#include "Util/SVFUtil.h"
|
|
@@ -124,7 +126,7 @@ public:
|
|
|
124
126
|
///@}
|
|
125
127
|
|
|
126
128
|
protected:
|
|
127
|
-
virtual inline void dumpPts(const PtsMap & ptsSet,
|
|
129
|
+
virtual inline void dumpPts(const PtsMap & ptsSet,OutStream & O = SVFUtil::outs()) const
|
|
128
130
|
{
|
|
129
131
|
for (PtsMapConstIter nodeIt = ptsSet.begin(); nodeIt != ptsSet.end(); nodeIt++)
|
|
130
132
|
{
|
|
@@ -581,10 +583,9 @@ public:
|
|
|
581
583
|
mutPTData.dumpPTData();
|
|
582
584
|
/// dump points-to of address-taken variables
|
|
583
585
|
std::error_code ErrInfo;
|
|
584
|
-
|
|
585
|
-
if (
|
|
586
|
+
std::fstream f("svfg_pts.data", std::ios_base::out);
|
|
587
|
+
if (f.good())
|
|
586
588
|
{
|
|
587
|
-
raw_fd_ostream & osm = F.os();
|
|
588
589
|
NodeBS locs;
|
|
589
590
|
for(DFPtsMapconstIter it = dfInPtsMap.begin(), eit = dfInPtsMap.end(); it!=eit; ++it)
|
|
590
591
|
locs.set(it->first);
|
|
@@ -597,31 +598,29 @@ public:
|
|
|
597
598
|
LocID loc = *it;
|
|
598
599
|
if (this->hasDFInSet(loc))
|
|
599
600
|
{
|
|
600
|
-
|
|
601
|
-
this->dumpPts(this->getDFInPtsMap(loc),
|
|
602
|
-
|
|
601
|
+
f << "Loc:" << loc << " IN:{";
|
|
602
|
+
this->dumpPts(this->getDFInPtsMap(loc), f);
|
|
603
|
+
f << "}\n";
|
|
603
604
|
}
|
|
604
605
|
|
|
605
606
|
if (this->hasDFOutSet(loc))
|
|
606
607
|
{
|
|
607
|
-
|
|
608
|
-
this->dumpPts(this->getDFOutPtsMap(loc),
|
|
609
|
-
|
|
608
|
+
f << "Loc:" << loc << " OUT:{";
|
|
609
|
+
this->dumpPts(this->getDFOutPtsMap(loc), f);
|
|
610
|
+
f << "}\n";
|
|
610
611
|
}
|
|
611
612
|
}
|
|
612
|
-
|
|
613
|
-
if (
|
|
613
|
+
f.close();
|
|
614
|
+
if (f.good())
|
|
614
615
|
{
|
|
615
616
|
SVFUtil::outs() << "\n";
|
|
616
|
-
F.keep();
|
|
617
617
|
return;
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
SVFUtil::outs() << " error opening file for writing!\n";
|
|
621
|
-
F.os().clear_error();
|
|
622
621
|
}
|
|
623
622
|
|
|
624
|
-
virtual inline void dumpPts(const PtsMap & ptsSet,
|
|
623
|
+
virtual inline void dumpPts(const PtsMap & ptsSet,OutStream & O = SVFUtil::outs()) const
|
|
625
624
|
{
|
|
626
625
|
for (PtsMapConstIter nodeIt = ptsSet.begin(); nodeIt != ptsSet.end(); nodeIt++)
|
|
627
626
|
{
|
|
@@ -296,31 +296,31 @@ public:
|
|
|
296
296
|
void printStats(const std::string subtitle) const
|
|
297
297
|
{
|
|
298
298
|
static const unsigned fieldWidth = 25;
|
|
299
|
-
|
|
299
|
+
SVFUtil::outs().flags(std::ios::left);
|
|
300
300
|
|
|
301
|
-
|
|
301
|
+
SVFUtil::outs() << "****Persistent Points-To Cache Statistics: " << subtitle << "****\n";
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "UniquePointsToSets" << idToPts.size() << "\n";
|
|
304
304
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
305
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "TotalUnions" << totalUnions << "\n";
|
|
306
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "PropertyUnions" << propertyUnions << "\n";
|
|
307
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "UniqueUnions" << uniqueUnions << "\n";
|
|
308
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "LookupUnions" << lookupUnions << "\n";
|
|
309
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "PreemptiveUnions" << preemptiveUnions << "\n";
|
|
310
310
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
311
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "TotalComplements" << totalComplements << "\n";
|
|
312
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "PropertyComplements" << propertyComplements << "\n";
|
|
313
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "UniqueComplements" << uniqueComplements << "\n";
|
|
314
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "LookupComplements" << lookupComplements << "\n";
|
|
315
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "PreemptiveComplements" << preemptiveComplements << "\n";
|
|
316
316
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
317
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "TotalIntersections" << totalIntersections << "\n";
|
|
318
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "PropertyIntersections" << propertyIntersections << "\n";
|
|
319
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "UniqueIntersections" << uniqueIntersections << "\n";
|
|
320
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "LookupIntersections" << lookupIntersections << "\n";
|
|
321
|
+
SVFUtil::outs() << std::setw(fieldWidth) << "PreemptiveIntersections" << preemptiveIntersections << "\n";
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
SVFUtil::outs().flush();
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
/// Returns all points-to sets stored by this cache as keys to a map.
|
|
@@ -400,7 +400,7 @@ public:
|
|
|
400
400
|
//@}
|
|
401
401
|
|
|
402
402
|
/// Resolve indirect call edges
|
|
403
|
-
virtual void resolveIndCalls(const CallICFGNode* cs, const PointsTo& target, CallEdgeMap& newEdges
|
|
403
|
+
virtual void resolveIndCalls(const CallICFGNode* cs, const PointsTo& target, CallEdgeMap& newEdges);
|
|
404
404
|
/// Match arguments for callsite at caller and callee
|
|
405
405
|
bool matchArgs(const CallICFGNode* cs, const SVFFunction* callee);
|
|
406
406
|
|
|
@@ -536,15 +536,15 @@ public:
|
|
|
536
536
|
CPtSet cpts2;
|
|
537
537
|
expandFIObjs(pts2,cpts2);
|
|
538
538
|
if (containBlackHoleNode(cpts1) || containBlackHoleNode(cpts2))
|
|
539
|
-
return
|
|
539
|
+
return AliasResult::MayAlias;
|
|
540
540
|
else if(this->getAnalysisTy()==PathS_DDA && contains(cpts1,cpts2) && contains(cpts2,cpts1))
|
|
541
541
|
{
|
|
542
|
-
return
|
|
542
|
+
return AliasResult::MustAlias;
|
|
543
543
|
}
|
|
544
544
|
else if(overlap(cpts1,cpts2))
|
|
545
|
-
return
|
|
545
|
+
return AliasResult::MayAlias;
|
|
546
546
|
else
|
|
547
|
-
return
|
|
547
|
+
return AliasResult::NoAlias;
|
|
548
548
|
}
|
|
549
549
|
/// Test blk node for cpts
|
|
550
550
|
inline bool containBlackHoleNode(const CPtSet& cpts)
|
|
@@ -583,7 +583,7 @@ public:
|
|
|
583
583
|
}
|
|
584
584
|
else if (!SVFUtil::isa<DummyValVar>(node))
|
|
585
585
|
{
|
|
586
|
-
SVFUtil::outs() << "##<" << node->getValue()->getName() << "> ";
|
|
586
|
+
SVFUtil::outs() << "##<" << node->getValue()->getName().str() << "> ";
|
|
587
587
|
//SVFUtil::outs() << "Source Loc: " << SVFUtil::getSourceLoc(node->getValue());
|
|
588
588
|
}
|
|
589
589
|
|
|
@@ -167,7 +167,7 @@ public:
|
|
|
167
167
|
//@}
|
|
168
168
|
/// Overloading operator << for dumping SVFVar value
|
|
169
169
|
//@{
|
|
170
|
-
friend
|
|
170
|
+
friend OutStream& operator<< (OutStream &o, const SVFStmt &edge)
|
|
171
171
|
{
|
|
172
172
|
o << edge.toString();
|
|
173
173
|
return o;
|
|
@@ -250,7 +250,7 @@ public:
|
|
|
250
250
|
//@}
|
|
251
251
|
/// Overloading operator << for dumping SVFVar value
|
|
252
252
|
//@{
|
|
253
|
-
friend
|
|
253
|
+
friend OutStream& operator<< (OutStream &o, const SVFVar &node)
|
|
254
254
|
{
|
|
255
255
|
o << node.toString();
|
|
256
256
|
return o;
|
|
@@ -173,12 +173,6 @@ public:
|
|
|
173
173
|
return dl;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
/// Helper method to get the size of the type from target data layout
|
|
177
|
-
//@{
|
|
178
|
-
u32_t getTypeSizeInBytes(const Type* type);
|
|
179
|
-
u32_t getTypeSizeInBytes(const StructType *sty, u32_t field_index);
|
|
180
|
-
//@}
|
|
181
|
-
|
|
182
176
|
/// special value
|
|
183
177
|
// @{
|
|
184
178
|
static bool isNullPtrSym(const Value *val);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#ifndef SVF_FE_BASIC_TYPES_H
|
|
2
|
+
#define SVF_FE_BASIC_TYPES_H
|
|
3
|
+
|
|
4
|
+
#include <llvm/IR/Instructions.h>
|
|
5
|
+
#include <llvm/IR/Metadata.h>
|
|
6
|
+
|
|
7
|
+
#include <llvm/Support/SourceMgr.h>
|
|
8
|
+
|
|
9
|
+
typedef llvm::SMDiagnostic SMDiagnostic;
|
|
10
|
+
|
|
11
|
+
typedef llvm::ExtractValueInst ExtractValueInst;
|
|
12
|
+
typedef llvm::ExtractElementInst ExtractElementInst;
|
|
13
|
+
typedef llvm::MetadataAsValue MetadataAsValue;
|
|
14
|
+
typedef llvm::BlockAddress BlockAddress;
|
|
15
|
+
|
|
16
|
+
typedef llvm::ConstantAggregate ConstantAggregate;
|
|
17
|
+
typedef llvm::ConstantAggregateZero ConstantAggregateZero;
|
|
18
|
+
|
|
19
|
+
#endif // SVF_FE_BASIC_TYPES_H
|
|
@@ -42,11 +42,6 @@ public:
|
|
|
42
42
|
return "Remove Constant GEP Expressions";
|
|
43
43
|
}
|
|
44
44
|
virtual bool runOnModule (Module & M);
|
|
45
|
-
virtual void getAnalysisUsage(AnalysisUsage &AU) const
|
|
46
|
-
{
|
|
47
|
-
// This pass does not modify the control-flow graph of the function
|
|
48
|
-
AU.setPreservesCFG();
|
|
49
|
-
}
|
|
50
45
|
};
|
|
51
46
|
|
|
52
47
|
|
|
@@ -92,12 +87,6 @@ public:
|
|
|
92
87
|
assert(!fn.isDeclaration() && "external function does not have DF");
|
|
93
88
|
return &getAnalysis<UnifyFunctionExitNodes>(const_cast<Function&>(fn));
|
|
94
89
|
}
|
|
95
|
-
virtual void getAnalysisUsage(AnalysisUsage &AU) const
|
|
96
|
-
{
|
|
97
|
-
// This pass does not modify the control-flow graph of the function
|
|
98
|
-
AU.addRequired<UnifyFunctionExitNodes>();
|
|
99
|
-
AU.addPreserved<BreakConstantGEPs>();
|
|
100
|
-
}
|
|
101
90
|
};
|
|
102
91
|
|
|
103
92
|
} // End namespace SVF
|
|
@@ -169,12 +169,6 @@ public:
|
|
|
169
169
|
{
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
virtual void getAnalysisUsage(AnalysisUsage &AU) const
|
|
173
|
-
{
|
|
174
|
-
AU.setPreservesAll();
|
|
175
|
-
// AU.addRequired<DominanceFrontier>();
|
|
176
|
-
}
|
|
177
|
-
|
|
178
172
|
// virtual bool runOnFunction(Function &m) {
|
|
179
173
|
// Frontiers.clear();
|
|
180
174
|
// DF = &getAnalysis<DominanceFrontier>();
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
#ifndef INCLUDE_SVF_FE_LLVMUTIL_H_
|
|
31
31
|
#define INCLUDE_SVF_FE_LLVMUTIL_H_
|
|
32
32
|
|
|
33
|
+
#include "SVF-FE/BasicTypes.h"
|
|
33
34
|
#include "Util/SVFUtil.h"
|
|
35
|
+
#include "SVF-FE/BasicTypes.h"
|
|
34
36
|
#include "Util/BasicTypes.h"
|
|
35
37
|
#include "Util/ExtAPI.h"
|
|
36
38
|
#include "Util/ThreadAPI.h"
|
|
@@ -416,12 +418,12 @@ inline bool ArgInDeadFunction (const Value * val)
|
|
|
416
418
|
/// Return true if this is a program entry function (e.g. main)
|
|
417
419
|
inline bool isProgEntryFunction (const SVFFunction * fun)
|
|
418
420
|
{
|
|
419
|
-
return fun && fun->getName()
|
|
421
|
+
return fun && fun->getName() == "main";
|
|
420
422
|
}
|
|
421
423
|
|
|
422
424
|
inline bool isProgEntryFunction (const Function * fun)
|
|
423
425
|
{
|
|
424
|
-
return fun && fun->getName()
|
|
426
|
+
return fun && fun->getName() == "main";
|
|
425
427
|
}
|
|
426
428
|
|
|
427
429
|
/// Get program entry function from module.
|
|
@@ -462,9 +464,9 @@ bool isPtrInDeadFunction (const Value * value);
|
|
|
462
464
|
//@{
|
|
463
465
|
inline bool isProgExitFunction (const SVFFunction * fun)
|
|
464
466
|
{
|
|
465
|
-
return fun && (fun->getName()
|
|
466
|
-
fun->getName()
|
|
467
|
-
fun->getName()
|
|
467
|
+
return fun && (fun->getName() == "exit" ||
|
|
468
|
+
fun->getName() == "__assert_rtn" ||
|
|
469
|
+
fun->getName() == "__assert_fail" );
|
|
468
470
|
}
|
|
469
471
|
|
|
470
472
|
inline bool isProgExitCall(const CallSite cs)
|
|
@@ -636,6 +638,14 @@ bool isIRFile(const std::string &filename);
|
|
|
636
638
|
void processArguments(int argc, char **argv, int &arg_num, char **arg_value,
|
|
637
639
|
std::vector<std::string> &moduleNameVec);
|
|
638
640
|
|
|
641
|
+
/// Helper method to get the size of the type from target data layout
|
|
642
|
+
//@{
|
|
643
|
+
u32_t getTypeSizeInBytes(const Type* type);
|
|
644
|
+
u32_t getTypeSizeInBytes(const StructType *sty, u32_t field_index);
|
|
645
|
+
//@}
|
|
646
|
+
|
|
647
|
+
const std::string type2String(const Type* type);
|
|
648
|
+
|
|
639
649
|
} // End namespace SVFUtil
|
|
640
650
|
|
|
641
651
|
} // End namespace SVF
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
#include <llvm/Analysis/CallGraph.h> // call graph
|
|
47
47
|
#include <llvm/IR/GlobalVariable.h> // for GlobalVariable
|
|
48
48
|
|
|
49
|
-
#include <llvm/Support/SourceMgr.h> // for SMDiagnostic
|
|
50
49
|
#include <llvm/Bitcode/BitcodeWriter.h> // for WriteBitcodeToFile
|
|
51
50
|
#include <llvm/Bitcode/BitcodeReader.h> /// for isBitcode
|
|
52
51
|
#include <llvm/IRReader/IRReader.h> // IR reader for bit file
|
|
@@ -70,7 +69,6 @@ class BddCond;
|
|
|
70
69
|
|
|
71
70
|
|
|
72
71
|
/// LLVM Basic classes
|
|
73
|
-
typedef llvm::SMDiagnostic SMDiagnostic;
|
|
74
72
|
typedef llvm::LLVMContext LLVMContext;
|
|
75
73
|
typedef llvm::Type Type;
|
|
76
74
|
typedef llvm::Function Function;
|
|
@@ -82,7 +80,6 @@ typedef llvm::GlobalObject GlobalObject;
|
|
|
82
80
|
typedef llvm::GlobalValue GlobalValue;
|
|
83
81
|
typedef llvm::GlobalVariable GlobalVariable;
|
|
84
82
|
typedef llvm::Module Module;
|
|
85
|
-
typedef llvm::CallGraph LLVMCallGraph;
|
|
86
83
|
typedef llvm::User User;
|
|
87
84
|
typedef llvm::Use Use;
|
|
88
85
|
typedef llvm::Loop Loop;
|
|
@@ -93,10 +90,8 @@ typedef llvm::LoopInfo LoopInfo;
|
|
|
93
90
|
typedef llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes;
|
|
94
91
|
#endif
|
|
95
92
|
typedef llvm::ModulePass ModulePass;
|
|
96
|
-
typedef llvm::AnalysisUsage AnalysisUsage;
|
|
97
93
|
|
|
98
94
|
/// LLVM outputs
|
|
99
|
-
typedef llvm::raw_ostream raw_ostream;
|
|
100
95
|
typedef llvm::raw_string_ostream raw_string_ostream;
|
|
101
96
|
typedef llvm::raw_fd_ostream raw_fd_ostream;
|
|
102
97
|
typedef llvm::StringRef StringRef;
|
|
@@ -108,8 +103,6 @@ typedef llvm::ArrayType ArrayType;
|
|
|
108
103
|
typedef llvm::PointerType PointerType;
|
|
109
104
|
typedef llvm::FunctionType FunctionType;
|
|
110
105
|
typedef llvm::VectorType VectorType;
|
|
111
|
-
typedef llvm::MetadataAsValue MetadataAsValue;
|
|
112
|
-
typedef llvm::BlockAddress BlockAddress;
|
|
113
106
|
|
|
114
107
|
/// LLVM data layout
|
|
115
108
|
typedef llvm::DataLayout DataLayout;
|
|
@@ -122,8 +115,6 @@ typedef llvm::MemoryLocation MemoryLocation;
|
|
|
122
115
|
typedef llvm::Argument Argument;
|
|
123
116
|
typedef llvm::Constant Constant;
|
|
124
117
|
typedef llvm::ConstantData ConstantData;
|
|
125
|
-
typedef llvm::ConstantAggregate ConstantAggregate;
|
|
126
|
-
typedef llvm::ConstantAggregateZero ConstantAggregateZero;
|
|
127
118
|
typedef llvm::ConstantDataSequential ConstantDataSequential;
|
|
128
119
|
typedef llvm::ConstantInt ConstantInt;
|
|
129
120
|
typedef llvm::ConstantFP ConstantFP;
|
|
@@ -132,9 +123,6 @@ typedef llvm::ConstantExpr ConstantExpr;
|
|
|
132
123
|
typedef llvm::ConstantPointerNull ConstantPointerNull;
|
|
133
124
|
typedef llvm::ConstantArray ConstantArray;
|
|
134
125
|
typedef llvm::GlobalAlias GlobalAlias;
|
|
135
|
-
typedef llvm::AliasResult AliasResult;
|
|
136
|
-
typedef llvm::ModRefInfo ModRefInfo;
|
|
137
|
-
typedef llvm::AnalysisID AnalysisID;
|
|
138
126
|
typedef llvm::ConstantDataArray ConstantDataArray;
|
|
139
127
|
|
|
140
128
|
/// LLVM metadata
|
|
@@ -160,13 +148,11 @@ typedef llvm::IntToPtrInst IntToPtrInst;
|
|
|
160
148
|
typedef llvm::CmpInst CmpInst;
|
|
161
149
|
typedef llvm::BranchInst BranchInst;
|
|
162
150
|
typedef llvm::SwitchInst SwitchInst;
|
|
163
|
-
typedef llvm::ExtractValueInst ExtractValueInst;
|
|
164
151
|
typedef llvm::InsertValueInst InsertValueInst;
|
|
165
152
|
typedef llvm::BinaryOperator BinaryOperator;
|
|
166
153
|
typedef llvm::UnaryOperator UnaryOperator;
|
|
167
154
|
typedef llvm::PtrToIntInst PtrToIntInst;
|
|
168
155
|
typedef llvm::VAArgInst VAArgInst;
|
|
169
|
-
typedef llvm::ExtractElementInst ExtractElementInst;
|
|
170
156
|
typedef llvm::InsertElementInst InsertElementInst;
|
|
171
157
|
typedef llvm::ShuffleVectorInst ShuffleVectorInst;
|
|
172
158
|
typedef llvm::LandingPadInst LandingPadInst;
|
|
@@ -332,7 +318,7 @@ public:
|
|
|
332
318
|
};
|
|
333
319
|
|
|
334
320
|
template <typename F, typename S>
|
|
335
|
-
|
|
321
|
+
OutStream& operator<< (OutStream &o, const std::pair<F, S> &var)
|
|
336
322
|
{
|
|
337
323
|
o << "<" << var.first << ", " << var.second << ">";
|
|
338
324
|
return o;
|
|
@@ -162,7 +162,7 @@ public:
|
|
|
162
162
|
void ddClearFlag(BranchCond * f) const;
|
|
163
163
|
void BddSupportStep( BranchCond * f, NodeBS &support) const;
|
|
164
164
|
void extractSubConds( BranchCond * f, NodeBS &support) const;
|
|
165
|
-
void dump(BranchCond* lhs,
|
|
165
|
+
void dump(BranchCond* lhs, OutStream & O);
|
|
166
166
|
std::string dumpStr(BranchCond* lhs) const;
|
|
167
167
|
|
|
168
168
|
private:
|