svf-lib 1.0.993 → 1.0.996
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-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
- package/SVF-osx/include/CFL/CFLAlias.h +26 -15
- package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
- package/SVF-osx/include/CFL/CFLSolver.h +9 -5
- package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
- package/SVF-osx/include/CUDD/cudd.h +20 -11
- package/SVF-osx/include/CUDD/cuddInt.h +48 -31
- package/SVF-osx/include/CUDD/epd.h +35 -29
- package/SVF-osx/include/CUDD/mtr.h +4 -3
- package/SVF-osx/include/CUDD/st.h +7 -4
- package/SVF-osx/include/CUDD/util.h +6 -6
- package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
- package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
- package/SVF-osx/include/Graphs/CHG.h +2 -2
- package/SVF-osx/include/Graphs/ConsG.h +2 -1
- package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
- package/SVF-osx/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
- package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
- package/SVF-osx/include/Graphs/IRGraph.h +10 -6
- package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-osx/include/Graphs/SVFG.h +4 -3
- package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
- package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
- package/SVF-osx/include/Graphs/VFG.h +45 -39
- package/SVF-osx/include/Graphs/VFGNode.h +8 -4
- package/SVF-osx/include/MSSA/MemSSA.h +1 -1
- package/SVF-osx/include/MTA/FSMPTA.h +55 -44
- package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
- package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
- package/SVF-osx/include/MTA/MHP.h +17 -13
- package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
- package/SVF-osx/include/MTA/PCG.h +9 -7
- package/SVF-osx/include/MTA/TCT.h +27 -22
- package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
- package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
- package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
- package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
- package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
- package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
- package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
- package/SVF-osx/include/SABER/ProgSlice.h +2 -1
- package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
- package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
- package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
- package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
- package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
- package/SVF-osx/include/Util/BDDExpr.h +32 -16
- package/SVF-osx/include/Util/BasicTypes.h +77 -25
- package/SVF-osx/include/Util/CoreBitVector.h +2 -1
- package/SVF-osx/include/Util/CxtStmt.h +37 -27
- package/SVF-osx/include/Util/ExeState.h +42 -22
- package/SVF-osx/include/Util/ExtAPI.h +1 -1
- package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
- package/SVF-osx/include/Util/Options.h +3 -3
- package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
- package/SVF-osx/include/Util/SVFModule.h +5 -5
- package/SVF-osx/include/Util/SVFUtil.h +12 -9
- package/SVF-osx/include/Util/Z3Expr.h +191 -144
- package/SVF-osx/include/WPA/Andersen.h +11 -11
- package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ class StInfo;
|
|
|
47
47
|
*/
|
|
48
48
|
class SymbolTableInfo
|
|
49
49
|
{
|
|
50
|
-
friend class SymbolTableBuilder;
|
|
50
|
+
friend class SymbolTableBuilder;
|
|
51
51
|
|
|
52
52
|
public:
|
|
53
53
|
|
|
@@ -154,7 +154,7 @@ public:
|
|
|
154
154
|
{
|
|
155
155
|
return mod;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
/// Module
|
|
158
158
|
inline void setModule(SVFModule* m)
|
|
159
159
|
{
|
|
160
160
|
mod = m;
|
|
@@ -278,7 +278,7 @@ public:
|
|
|
278
278
|
}
|
|
279
279
|
//@}
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
|
|
282
282
|
/// Statistics
|
|
283
283
|
//@{
|
|
284
284
|
inline u32_t getTotalSymNum() const
|
|
@@ -389,7 +389,7 @@ protected:
|
|
|
389
389
|
/*!
|
|
390
390
|
* Memory object symbols or MemObj (address-taken variables in LLVM-based languages)
|
|
391
391
|
*/
|
|
392
|
-
class MemObj
|
|
392
|
+
class MemObj
|
|
393
393
|
{
|
|
394
394
|
|
|
395
395
|
private:
|
|
@@ -427,7 +427,7 @@ public:
|
|
|
427
427
|
/// Get obj type
|
|
428
428
|
const Type* getType() const;
|
|
429
429
|
|
|
430
|
-
/// Get the number of elements of this object
|
|
430
|
+
/// Get the number of elements of this object
|
|
431
431
|
u32_t getNumOfElements() const;
|
|
432
432
|
|
|
433
433
|
/// Set the number of elements of this object
|
|
@@ -496,11 +496,11 @@ private:
|
|
|
496
496
|
/// All field infos after flattening a struct
|
|
497
497
|
std::vector<const Type*> finfo;
|
|
498
498
|
/// stride represents the number of repetitive elements if this StInfo represent an ArrayType. stride is 1 by default.
|
|
499
|
-
u32_t stride;
|
|
499
|
+
u32_t stride;
|
|
500
500
|
/// number of elements after flattenning (including array elements)
|
|
501
|
-
u32_t numOfFlattenElements;
|
|
501
|
+
u32_t numOfFlattenElements;
|
|
502
502
|
/// number of fields after flattenning (ignoring array elements)
|
|
503
|
-
u32_t numOfFlattenFields;
|
|
503
|
+
u32_t numOfFlattenFields;
|
|
504
504
|
/// Type vector of fields
|
|
505
505
|
std::vector<const Type*> flattenElementTypes;
|
|
506
506
|
/// Max field limit
|
|
@@ -554,16 +554,19 @@ public:
|
|
|
554
554
|
}
|
|
555
555
|
|
|
556
556
|
/// Return number of elements after flattenning (including array elements)
|
|
557
|
-
inline u32_t getNumOfFlattenElements() const
|
|
557
|
+
inline u32_t getNumOfFlattenElements() const
|
|
558
|
+
{
|
|
558
559
|
return numOfFlattenElements;
|
|
559
560
|
}
|
|
560
561
|
|
|
561
562
|
/// Return the number of fields after flattenning (ignoring array elements)
|
|
562
|
-
inline u32_t getNumOfFlattenFields() const
|
|
563
|
+
inline u32_t getNumOfFlattenFields() const
|
|
564
|
+
{
|
|
563
565
|
return numOfFlattenFields;
|
|
564
566
|
}
|
|
565
567
|
/// Return the stride
|
|
566
|
-
inline u32_t getStride() const
|
|
568
|
+
inline u32_t getStride() const
|
|
569
|
+
{
|
|
567
570
|
return stride;
|
|
568
571
|
}
|
|
569
572
|
};
|
|
@@ -573,7 +576,7 @@ public:
|
|
|
573
576
|
*/
|
|
574
577
|
class ObjTypeInfo
|
|
575
578
|
{
|
|
576
|
-
friend class SymbolTableBuilder;
|
|
579
|
+
friend class SymbolTableBuilder;
|
|
577
580
|
public:
|
|
578
581
|
typedef enum
|
|
579
582
|
{
|
|
@@ -613,7 +616,7 @@ public:
|
|
|
613
616
|
virtual ~ObjTypeInfo()
|
|
614
617
|
{
|
|
615
618
|
}
|
|
616
|
-
|
|
619
|
+
|
|
617
620
|
/// Get LLVM type
|
|
618
621
|
inline const Type* getType() const
|
|
619
622
|
{
|
|
@@ -632,14 +635,14 @@ public:
|
|
|
632
635
|
maxOffsetLimit = limit;
|
|
633
636
|
}
|
|
634
637
|
|
|
635
|
-
/// Set the number of elements of this object
|
|
638
|
+
/// Set the number of elements of this object
|
|
636
639
|
inline void setNumOfElements(u32_t num)
|
|
637
640
|
{
|
|
638
641
|
elemNum = num;
|
|
639
642
|
setMaxFieldOffsetLimit(num);
|
|
640
643
|
}
|
|
641
644
|
|
|
642
|
-
/// Get the number of elements of this object
|
|
645
|
+
/// Get the number of elements of this object
|
|
643
646
|
inline u32_t getNumOfElements() const
|
|
644
647
|
{
|
|
645
648
|
return elemNum;
|
|
@@ -133,12 +133,14 @@ public:
|
|
|
133
133
|
{
|
|
134
134
|
return condMgr->getCondInst(cond);
|
|
135
135
|
}
|
|
136
|
-
inline void setCondInst(const Condition* cond, const Instruction* inst)
|
|
136
|
+
inline void setCondInst(const Condition* cond, const Instruction* inst)
|
|
137
|
+
{
|
|
137
138
|
condMgr->setCondInst(cond, inst);
|
|
138
139
|
}
|
|
139
140
|
//@}
|
|
140
141
|
|
|
141
|
-
bool isNegCond(const Condition *condition)
|
|
142
|
+
bool isNegCond(const Condition *condition)
|
|
143
|
+
{
|
|
142
144
|
return condMgr->isNegCond(condition);
|
|
143
145
|
}
|
|
144
146
|
|
|
@@ -189,20 +191,24 @@ public:
|
|
|
189
191
|
void printPathCond();
|
|
190
192
|
|
|
191
193
|
/// whether condition is satisfiable
|
|
192
|
-
inline bool isSatisfiable(Condition* condition)
|
|
194
|
+
inline bool isSatisfiable(Condition* condition)
|
|
195
|
+
{
|
|
193
196
|
return condMgr->isSatisfiable(condition);
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
/// whether condition is satisfiable for all possible boolean guards
|
|
197
|
-
inline bool isAllPathReachable(Condition* condition)
|
|
200
|
+
inline bool isAllPathReachable(Condition* condition)
|
|
201
|
+
{
|
|
198
202
|
return condMgr->isAllPathReachable(condition);
|
|
199
203
|
}
|
|
200
204
|
|
|
201
|
-
bool isEquivalentBranchCond(const Condition *lhs, const Condition *rhs) const
|
|
205
|
+
bool isEquivalentBranchCond(const Condition *lhs, const Condition *rhs) const
|
|
206
|
+
{
|
|
202
207
|
return condMgr->isEquivalentBranchCond(lhs, rhs);
|
|
203
208
|
}
|
|
204
209
|
|
|
205
|
-
inline ICFG* getICFG() const
|
|
210
|
+
inline ICFG* getICFG() const
|
|
211
|
+
{
|
|
206
212
|
return PAG::getPAG()->getICFG();
|
|
207
213
|
}
|
|
208
214
|
|
|
@@ -276,7 +282,8 @@ private:
|
|
|
276
282
|
|
|
277
283
|
|
|
278
284
|
/// Release memory
|
|
279
|
-
void destroy()
|
|
285
|
+
void destroy()
|
|
286
|
+
{
|
|
280
287
|
|
|
281
288
|
}
|
|
282
289
|
|
|
@@ -253,7 +253,8 @@ protected:
|
|
|
253
253
|
}
|
|
254
254
|
//@}
|
|
255
255
|
|
|
256
|
-
inline bool isEquivalentBranchCond(const Condition *lhs, const Condition *rhs) const
|
|
256
|
+
inline bool isEquivalentBranchCond(const Condition *lhs, const Condition *rhs) const
|
|
257
|
+
{
|
|
257
258
|
return pathAllocator->isEquivalentBranchCond(lhs, rhs);
|
|
258
259
|
};
|
|
259
260
|
|
|
@@ -169,19 +169,23 @@ public:
|
|
|
169
169
|
///@{
|
|
170
170
|
virtual void initSrcs() = 0;
|
|
171
171
|
virtual void initSnks() = 0;
|
|
172
|
-
virtual bool isSourceLikeFun(const SVFFunction* fun)
|
|
172
|
+
virtual bool isSourceLikeFun(const SVFFunction* fun)
|
|
173
|
+
{
|
|
173
174
|
return false;
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
virtual bool isSinkLikeFun(const SVFFunction* fun)
|
|
177
|
+
virtual bool isSinkLikeFun(const SVFFunction* fun)
|
|
178
|
+
{
|
|
177
179
|
return false;
|
|
178
180
|
}
|
|
179
181
|
|
|
180
|
-
bool isSource(const SVFGNode* node) const
|
|
182
|
+
bool isSource(const SVFGNode* node) const
|
|
183
|
+
{
|
|
181
184
|
return getSources().find(node)!=getSources().end();
|
|
182
185
|
}
|
|
183
186
|
|
|
184
|
-
bool isSink(const SVFGNode* node) const
|
|
187
|
+
bool isSink(const SVFGNode* node) const
|
|
188
|
+
{
|
|
185
189
|
return getSinks().find(node)!=getSinks().end();
|
|
186
190
|
}
|
|
187
191
|
///@}
|
|
@@ -119,25 +119,26 @@ public:
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
class PTACFInfoBuilder
|
|
122
|
+
class PTACFInfoBuilder
|
|
123
|
+
{
|
|
123
124
|
public:
|
|
124
125
|
typedef Map<const Function*, DominatorTree*> FunToDTMap; ///< map a function to its dominator tree
|
|
125
126
|
typedef Map<const Function*, PostDominatorTree*> FunToPostDTMap; ///< map a function to its post dominator tree
|
|
126
127
|
typedef Map<const Function*, LoopInfo*> FunToLoopInfoMap; ///< map a function to its loop info
|
|
127
128
|
|
|
128
129
|
/// Constructor
|
|
129
|
-
|
|
130
|
+
PTACFInfoBuilder();
|
|
130
131
|
|
|
131
|
-
|
|
132
|
+
~PTACFInfoBuilder();
|
|
132
133
|
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
/// Get loop info of a function
|
|
135
|
+
LoopInfo* getLoopInfo(const Function* f);
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
/// Get post dominator tree of a function
|
|
138
|
+
PostDominatorTree* getPostDT(const Function* f);
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
/// Get dominator tree of a function
|
|
141
|
+
DominatorTree* getDT(const Function* f);
|
|
141
142
|
|
|
142
143
|
private:
|
|
143
144
|
FunToLoopInfoMap funToLoopInfoMap; ///< map a function to its loop info
|
|
@@ -33,7 +33,7 @@ public:
|
|
|
33
33
|
this->ptsTo = ptsTo;
|
|
34
34
|
mainModule = LLVMModuleSet::getLLVMModuleSet()->getMainLLVMModule();
|
|
35
35
|
|
|
36
|
-
// Add a named metadata node used to check whether or not
|
|
36
|
+
// Add a named metadata node used to check whether or not
|
|
37
37
|
// this IR has been annotated with Andersen information
|
|
38
38
|
if (writeFlag)
|
|
39
39
|
mainModule->getOrInsertNamedMetadata("SVFIR-Annotated");
|
|
@@ -146,7 +146,7 @@ private:
|
|
|
146
146
|
void processInstructionNode(Instruction *instruction, const SVF::NodeID &nodeId, bool writeFlag)
|
|
147
147
|
{
|
|
148
148
|
std::string label = "inode-" + std::to_string(nodeId);
|
|
149
|
-
|
|
149
|
+
|
|
150
150
|
if (writeFlag)
|
|
151
151
|
{
|
|
152
152
|
LLVMContext &context = instruction->getContext();
|
|
@@ -164,7 +164,7 @@ private:
|
|
|
164
164
|
void processArgumentNode(Argument *argument, const SVF::NodeID &nodeId, bool writeFlag)
|
|
165
165
|
{
|
|
166
166
|
std::string label = "anode-" + std::to_string(nodeId);
|
|
167
|
-
|
|
167
|
+
|
|
168
168
|
if (writeFlag)
|
|
169
169
|
{
|
|
170
170
|
LLVMContext &context = argument->getContext();
|
|
@@ -182,7 +182,7 @@ private:
|
|
|
182
182
|
void processFunctionNode(Function *function, const SVF::NodeID &nodeId, bool writeFlag)
|
|
183
183
|
{
|
|
184
184
|
std::string label = "fnode-" + std::to_string(nodeId);
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
if (writeFlag)
|
|
187
187
|
{
|
|
188
188
|
LLVMContext &context = function->getContext();
|
|
@@ -200,7 +200,7 @@ private:
|
|
|
200
200
|
void processGlobalVarNode(GlobalVariable *globalVar, const SVF::NodeID &nodeId, bool writeFlag)
|
|
201
201
|
{
|
|
202
202
|
std::string label = "gnode-" + std::to_string(nodeId);
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
if (writeFlag)
|
|
205
205
|
{
|
|
206
206
|
LLVMContext &context = globalVar->getContext();
|
|
@@ -218,7 +218,7 @@ private:
|
|
|
218
218
|
void processBasicBlockNode(BasicBlock *basicBlock, const SVF::NodeID &nodeId, bool writeFlag)
|
|
219
219
|
{
|
|
220
220
|
std::string label = "bnode-" + std::to_string(nodeId);
|
|
221
|
-
|
|
221
|
+
|
|
222
222
|
if (writeFlag)
|
|
223
223
|
{
|
|
224
224
|
LLVMContext &context = basicBlock->getContext();
|
|
@@ -236,7 +236,7 @@ private:
|
|
|
236
236
|
void processConstantNode(const SVF::NodeID &nodeId, bool writeFlag)
|
|
237
237
|
{
|
|
238
238
|
std::string label = "cnode-" + std::to_string(nodeId);
|
|
239
|
-
|
|
239
|
+
|
|
240
240
|
if (writeFlag)
|
|
241
241
|
{
|
|
242
242
|
LLVMContext &context = mainModule->getContext();
|
|
@@ -254,7 +254,7 @@ private:
|
|
|
254
254
|
void processInlineAsmNode(llvm::InlineAsm *inlineAsm, const SVF::NodeID &nodeId, bool writeFlag)
|
|
255
255
|
{
|
|
256
256
|
std::string label = "iAsmnode-" + std::to_string(nodeId);
|
|
257
|
-
|
|
257
|
+
|
|
258
258
|
if (writeFlag)
|
|
259
259
|
{
|
|
260
260
|
LLVMContext &context = mainModule->getContext();
|
|
@@ -83,10 +83,11 @@ public:
|
|
|
83
83
|
SVFModule* buildSVFModule(Module &mod);
|
|
84
84
|
SVFModule* buildSVFModule(const std::vector<std::string> &moduleNameVec);
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
inline SVFModule* getSVFModule()
|
|
87
|
+
{
|
|
88
|
+
assert(svfModule && "svfModule has not been built yet!");
|
|
89
|
+
return svfModule;
|
|
90
|
+
}
|
|
90
91
|
|
|
91
92
|
void preProcessBCs(std::vector<std::string> &moduleNameVec);
|
|
92
93
|
|
|
@@ -148,15 +149,15 @@ public:
|
|
|
148
149
|
|
|
149
150
|
bool hasDeclaration(const SVFFunction *fun) const
|
|
150
151
|
{
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
if(fun->isDeclaration() && !hasDefinition(fun))
|
|
153
|
+
return false;
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
const SVFFunction* funDef = fun;
|
|
155
156
|
if(fun->isDeclaration() && hasDefinition(fun))
|
|
156
|
-
|
|
157
|
+
funDef = getDefinition(fun);
|
|
157
158
|
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
FunDefToDeclsMapTy::const_iterator it = FunDefToDeclsMap.find(funDef);
|
|
160
|
+
return it != FunDefToDeclsMap.end();
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
const FunctionSetType& getDeclaration(const Function *fun) const
|
|
@@ -166,9 +167,9 @@ public:
|
|
|
166
167
|
|
|
167
168
|
const FunctionSetType& getDeclaration(const SVFFunction *fun) const
|
|
168
169
|
{
|
|
169
|
-
|
|
170
|
+
const SVFFunction* funDef = fun;
|
|
170
171
|
if(fun->isDeclaration() && hasDefinition(fun))
|
|
171
|
-
|
|
172
|
+
funDef = getDefinition(fun);
|
|
172
173
|
|
|
173
174
|
FunDefToDeclsMapTy::const_iterator it = FunDefToDeclsMap.find(funDef);
|
|
174
175
|
assert(it != FunDefToDeclsMap.end() && "does not have a function definition (body)?");
|
|
@@ -406,10 +406,10 @@ bool isObject (const Value * ref);
|
|
|
406
406
|
/// Return true if the value refers to constant data, e.g., i32 0
|
|
407
407
|
inline bool isConstantData(const Value* val)
|
|
408
408
|
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
return SVFUtil::isa<ConstantData>(val)
|
|
410
|
+
|| SVFUtil::isa<ConstantAggregate>(val)
|
|
411
|
+
|| SVFUtil::isa<MetadataAsValue>(val)
|
|
412
|
+
|| SVFUtil::isa<BlockAddress>(val);
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
/// Method for dead function, which does not have any possible caller
|
|
@@ -130,8 +130,9 @@ public:
|
|
|
130
130
|
{
|
|
131
131
|
visitCallSite(&II);
|
|
132
132
|
}
|
|
133
|
-
void visitCallBrInst(CallBrInst &I)
|
|
134
|
-
|
|
133
|
+
void visitCallBrInst(CallBrInst &I)
|
|
134
|
+
{
|
|
135
|
+
return visitCallSite(&I);
|
|
135
136
|
}
|
|
136
137
|
void visitCallSite(CallSite cs);
|
|
137
138
|
void visitReturnInst(ReturnInst &I);
|
|
@@ -155,9 +156,9 @@ public:
|
|
|
155
156
|
/// TODO: var arguments need to be handled.
|
|
156
157
|
/// https://llvm.org/docs/LangRef.html#id1911
|
|
157
158
|
void visitVAArgInst(VAArgInst&);
|
|
158
|
-
void visitVACopyInst(VACopyInst&){}
|
|
159
|
-
void visitVAEndInst(VAEndInst&){}
|
|
160
|
-
void visitVAStartInst(VAStartInst&){}
|
|
159
|
+
void visitVACopyInst(VACopyInst&) {}
|
|
160
|
+
void visitVAEndInst(VAEndInst&) {}
|
|
161
|
+
void visitVAStartInst(VAStartInst&) {}
|
|
161
162
|
|
|
162
163
|
/// <result> = freeze ty <val>
|
|
163
164
|
/// If <val> is undef or poison, ‘freeze’ returns an arbitrary, but fixed value of type `ty`
|
|
@@ -293,7 +294,8 @@ protected:
|
|
|
293
294
|
/// Add Address edge
|
|
294
295
|
inline AddrStmt* addAddrEdge(NodeID src, NodeID dst)
|
|
295
296
|
{
|
|
296
|
-
if(AddrStmt *edge = pag->addAddrStmt(src, dst))
|
|
297
|
+
if(AddrStmt *edge = pag->addAddrStmt(src, dst))
|
|
298
|
+
{
|
|
297
299
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
298
300
|
return edge;
|
|
299
301
|
}
|
|
@@ -302,7 +304,8 @@ protected:
|
|
|
302
304
|
/// Add Copy edge
|
|
303
305
|
inline CopyStmt* addCopyEdge(NodeID src, NodeID dst)
|
|
304
306
|
{
|
|
305
|
-
if(CopyStmt *edge = pag->addCopyStmt(src, dst))
|
|
307
|
+
if(CopyStmt *edge = pag->addCopyStmt(src, dst))
|
|
308
|
+
{
|
|
306
309
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
307
310
|
return edge;
|
|
308
311
|
}
|
|
@@ -339,8 +342,9 @@ protected:
|
|
|
339
342
|
if(UnaryOPStmt *edge = pag->addUnaryOPStmt(src, dst, opcode))
|
|
340
343
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
341
344
|
}
|
|
342
|
-
/// Add Branch statement
|
|
343
|
-
inline void addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec& succs)
|
|
345
|
+
/// Add Branch statement
|
|
346
|
+
inline void addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec& succs)
|
|
347
|
+
{
|
|
344
348
|
if(BranchStmt *edge = pag->addBranchStmt(br, cond, succs))
|
|
345
349
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
346
350
|
}
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
namespace SVF
|
|
40
40
|
{
|
|
41
41
|
|
|
42
|
-
class SymbolTableBuilder
|
|
42
|
+
class SymbolTableBuilder
|
|
43
43
|
{
|
|
44
44
|
|
|
45
45
|
private:
|
|
@@ -47,7 +47,8 @@ private:
|
|
|
47
47
|
|
|
48
48
|
public:
|
|
49
49
|
/// Constructor
|
|
50
|
-
SymbolTableBuilder(SymbolTableInfo* si): symInfo(si)
|
|
50
|
+
SymbolTableBuilder(SymbolTableInfo* si): symInfo(si)
|
|
51
|
+
{
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
/// Start building memory model
|
|
@@ -36,9 +36,11 @@
|
|
|
36
36
|
#include "CUDD/cuddInt.h"
|
|
37
37
|
#include "z3++.h"
|
|
38
38
|
|
|
39
|
-
namespace SVF
|
|
39
|
+
namespace SVF
|
|
40
|
+
{
|
|
40
41
|
|
|
41
|
-
class BDDExprManager
|
|
42
|
+
class BDDExprManager
|
|
43
|
+
{
|
|
42
44
|
public:
|
|
43
45
|
typedef DdNode BDDExpr;
|
|
44
46
|
typedef Map<u32_t, BDDExpr *> IndexToBDDExpr;
|
|
@@ -47,11 +49,13 @@ private:
|
|
|
47
49
|
IndexToBDDExpr indexToBddCondMap;
|
|
48
50
|
DdManager *m_bdd_mgr;
|
|
49
51
|
|
|
50
|
-
inline BDDExpr *BddOne() const
|
|
52
|
+
inline BDDExpr *BddOne() const
|
|
53
|
+
{
|
|
51
54
|
return Cudd_ReadOne(m_bdd_mgr);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
inline BDDExpr *BddZero() const
|
|
57
|
+
inline BDDExpr *BddZero() const
|
|
58
|
+
{
|
|
55
59
|
return Cudd_ReadLogicZero(m_bdd_mgr);
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -65,7 +69,8 @@ public:
|
|
|
65
69
|
//@{
|
|
66
70
|
static BDDExprManager *getBDDExprMgr();
|
|
67
71
|
|
|
68
|
-
static void releaseBDDExprMgr()
|
|
72
|
+
static void releaseBDDExprMgr()
|
|
73
|
+
{
|
|
69
74
|
delete bddExprMgr;
|
|
70
75
|
bddExprMgr = nullptr;
|
|
71
76
|
}
|
|
@@ -74,7 +79,8 @@ public:
|
|
|
74
79
|
/// Destructor
|
|
75
80
|
virtual ~BDDExprManager();
|
|
76
81
|
|
|
77
|
-
BDDExpr *createCond(u32_t i)
|
|
82
|
+
BDDExpr *createCond(u32_t i)
|
|
83
|
+
{
|
|
78
84
|
assert(indexToBddCondMap.find(i) == indexToBddCondMap.end() &&
|
|
79
85
|
"This should be fresh index to create new BDD");
|
|
80
86
|
BDDExpr *bddCond = Cudd_bddIthVar(m_bdd_mgr, i);
|
|
@@ -85,18 +91,21 @@ public:
|
|
|
85
91
|
virtual BDDExpr *createFreshBranchCond(const Instruction *inst);
|
|
86
92
|
|
|
87
93
|
/// Return the number of condition expressions
|
|
88
|
-
virtual inline u32_t getCondNumber()
|
|
94
|
+
virtual inline u32_t getCondNumber()
|
|
95
|
+
{
|
|
89
96
|
return Cudd_ReadNodeCount(m_bdd_mgr);
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
|
|
93
100
|
/// Return the unique true condition
|
|
94
|
-
inline BDDExpr *getTrueCond() const
|
|
101
|
+
inline BDDExpr *getTrueCond() const
|
|
102
|
+
{
|
|
95
103
|
return trueCond;
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
/// Return the unique false condition
|
|
99
|
-
inline BDDExpr *getFalseCond() const
|
|
107
|
+
inline BDDExpr *getFalseCond() const
|
|
108
|
+
{
|
|
100
109
|
return falseCond;
|
|
101
110
|
}
|
|
102
111
|
|
|
@@ -109,17 +118,20 @@ public:
|
|
|
109
118
|
virtual BDDExpr *NEG(BDDExpr *lhs);
|
|
110
119
|
//@}
|
|
111
120
|
|
|
112
|
-
virtual bool isNegCond(const BDDExpr *cond)
|
|
121
|
+
virtual bool isNegCond(const BDDExpr *cond)
|
|
122
|
+
{
|
|
113
123
|
return false;
|
|
114
124
|
}
|
|
115
125
|
|
|
116
126
|
/// Whether the condition is satisfiable
|
|
117
|
-
virtual bool isSatisfiable(const BDDExpr *cond)
|
|
127
|
+
virtual bool isSatisfiable(const BDDExpr *cond)
|
|
128
|
+
{
|
|
118
129
|
return cond != getFalseCond();
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
/// Whether lhs and rhs are equivalent branch conditions
|
|
122
|
-
virtual bool isEquivalentBranchCond(const BDDExpr *lhs, const BDDExpr *rhs)
|
|
133
|
+
virtual bool isEquivalentBranchCond(const BDDExpr *lhs, const BDDExpr *rhs)
|
|
134
|
+
{
|
|
123
135
|
return lhs == rhs;
|
|
124
136
|
}
|
|
125
137
|
|
|
@@ -127,7 +139,8 @@ public:
|
|
|
127
139
|
bool isAllPathReachable(const BDDExpr *e);
|
|
128
140
|
|
|
129
141
|
/// Get condition using condition id (z3 ast id)
|
|
130
|
-
virtual BDDExpr *getCond(u32_t id)
|
|
142
|
+
virtual BDDExpr *getCond(u32_t id)
|
|
143
|
+
{
|
|
131
144
|
auto it = indexToBddCondMap.find(id);
|
|
132
145
|
assert(it != indexToBddCondMap.end() && "condition not found!");
|
|
133
146
|
return it->second;
|
|
@@ -135,13 +148,15 @@ public:
|
|
|
135
148
|
|
|
136
149
|
/// Get/Set llvm conditional expression
|
|
137
150
|
//{@
|
|
138
|
-
inline const Instruction *getCondInst(const BDDExpr *cond) const
|
|
151
|
+
inline const Instruction *getCondInst(const BDDExpr *cond) const
|
|
152
|
+
{
|
|
139
153
|
CondToTermInstMap::const_iterator it = condToInstMap.find(cond);
|
|
140
154
|
assert(it != condToInstMap.end() && "this should be a fresh condition");
|
|
141
155
|
return it->second;
|
|
142
156
|
}
|
|
143
157
|
|
|
144
|
-
inline void setCondInst(const BDDExpr *cond, const Instruction *inst)
|
|
158
|
+
inline void setCondInst(const BDDExpr *cond, const Instruction *inst)
|
|
159
|
+
{
|
|
145
160
|
assert(condToInstMap.find(cond) == condToInstMap.end() && "this should be a fresh condition");
|
|
146
161
|
condToInstMap[cond] = inst;
|
|
147
162
|
}
|
|
@@ -161,7 +176,8 @@ public:
|
|
|
161
176
|
|
|
162
177
|
std::string dumpStr(const BDDExpr *e) const;
|
|
163
178
|
|
|
164
|
-
inline std::string getMemUsage()
|
|
179
|
+
inline std::string getMemUsage()
|
|
180
|
+
{
|
|
165
181
|
return std::to_string(Cudd_ReadMemoryInUse(m_bdd_mgr));
|
|
166
182
|
}
|
|
167
183
|
|