svf-lib 1.0.1245 → 1.0.1247
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/SABER/SaberCondAllocator.h +0 -7
- package/SVF-linux/include/SVF-FE/BasicTypes.h +7 -0
- package/SVF-linux/include/Util/BasicTypes.h +52 -17
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/SABER/SaberCondAllocator.h +0 -7
- package/SVF-osx/include/SVF-FE/BasicTypes.h +7 -0
- package/SVF-osx/include/Util/BasicTypes.h +52 -17
- package/package.json +1 -1
|
Binary file
|
|
@@ -162,13 +162,6 @@ public:
|
|
|
162
162
|
return keyFunc->dominate(bbKey,bbValue);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
/// Get LoopInfo
|
|
166
|
-
inline LoopInfo* getLoopInfo(const Function* f)
|
|
167
|
-
{
|
|
168
|
-
return cfInfoBuilder.getLoopInfo(f);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
165
|
/// Guard Computation for a value-flow (between two basic blocks)
|
|
173
166
|
//@{
|
|
174
167
|
virtual Condition ComputeIntraVFGGuard(const BasicBlock* src, const BasicBlock* dst);
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
|
|
27
27
|
#include <llvm/Support/SourceMgr.h>
|
|
28
28
|
|
|
29
|
+
#include "llvm/Analysis/LoopInfo.h"
|
|
30
|
+
|
|
29
31
|
namespace SVF
|
|
30
32
|
{
|
|
31
33
|
|
|
@@ -73,6 +75,11 @@ typedef llvm::DominanceFrontier DominanceFrontier;
|
|
|
73
75
|
typedef llvm::PostDominatorTree PostDominatorTree;
|
|
74
76
|
typedef llvm::DominanceFrontierBase<llvm::BasicBlock, false> DominanceFrontierBase;
|
|
75
77
|
|
|
78
|
+
/// LLVM Loop
|
|
79
|
+
typedef llvm::Loop Loop;
|
|
80
|
+
typedef llvm::LoopInfo LoopInfo;
|
|
81
|
+
typedef llvm::User User;
|
|
82
|
+
|
|
76
83
|
// LLVM Instructions
|
|
77
84
|
typedef llvm::AllocaInst AllocaInst;
|
|
78
85
|
typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
#include <llvm/BinaryFormat/Dwarf.h>
|
|
56
56
|
#endif
|
|
57
57
|
|
|
58
|
-
#include "llvm/Analysis/LoopInfo.h"
|
|
59
58
|
#include "llvm/IR/CFG.h"
|
|
60
59
|
#include "llvm/BinaryFormat/Dwarf.h"
|
|
61
60
|
|
|
@@ -74,9 +73,6 @@ typedef llvm::Instruction Instruction;
|
|
|
74
73
|
typedef llvm::CallBase CallBase;
|
|
75
74
|
typedef llvm::GlobalValue GlobalValue;
|
|
76
75
|
typedef llvm::GlobalVariable GlobalVariable;
|
|
77
|
-
typedef llvm::User User;
|
|
78
|
-
typedef llvm::Loop Loop;
|
|
79
|
-
typedef llvm::LoopInfo LoopInfo;
|
|
80
76
|
|
|
81
77
|
/// LLVM outputs
|
|
82
78
|
typedef llvm::raw_string_ostream raw_string_ostream;
|
|
@@ -129,11 +125,8 @@ private:
|
|
|
129
125
|
Map<const BasicBlock*,Set<const BasicBlock*>> dtBBsMap;
|
|
130
126
|
Map<const BasicBlock*,Set<const BasicBlock*>> dfBBsMap;
|
|
131
127
|
Map<const BasicBlock*,Set<const BasicBlock*>> pdtBBsMap;
|
|
128
|
+
Map<const BasicBlock*,std::vector<const BasicBlock*>> bb2LoopMap;
|
|
132
129
|
public:
|
|
133
|
-
SVFFunction(const std::string& val): SVFValue(val,SVFValue::SVFFunc),
|
|
134
|
-
isDecl(false), isIntri(false), fun(nullptr), exitBB(nullptr), isUncalled(false), isNotRet(false)
|
|
135
|
-
{
|
|
136
|
-
}
|
|
137
130
|
|
|
138
131
|
SVFFunction(Function* f): SVFValue(f->getName().str(),SVFValue::SVFFunc),
|
|
139
132
|
isDecl(f->isDeclaration()), isIntri(f->isIntrinsic()), fun(f), exitBB(nullptr), isUncalled(false), isNotRet(false)
|
|
@@ -216,6 +209,28 @@ public:
|
|
|
216
209
|
return dfBBsMap;
|
|
217
210
|
}
|
|
218
211
|
|
|
212
|
+
inline bool hasLoopInfo(const BasicBlock* bb) const
|
|
213
|
+
{
|
|
214
|
+
return bb2LoopMap.find(bb)!=bb2LoopMap.end();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
inline const std::vector<const BasicBlock*>& getLoopInfo(const BasicBlock* bb) const
|
|
218
|
+
{
|
|
219
|
+
Map<const BasicBlock*, std::vector<const BasicBlock*>>::const_iterator mapIter = bb2LoopMap.find(bb);
|
|
220
|
+
if(mapIter != bb2LoopMap.end())
|
|
221
|
+
return mapIter->second;
|
|
222
|
+
else
|
|
223
|
+
{
|
|
224
|
+
assert(hasLoopInfo(bb) && "loopinfo does not exit(bb not in a loop)");
|
|
225
|
+
abort();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
inline void addToBB2LoopMap(const BasicBlock* bb, const BasicBlock* loopBB)
|
|
230
|
+
{
|
|
231
|
+
bb2LoopMap[bb].push_back(loopBB);
|
|
232
|
+
}
|
|
233
|
+
|
|
219
234
|
inline const Map<const BasicBlock*,Set<const BasicBlock*>>& getPostDomTreeMap() const
|
|
220
235
|
{
|
|
221
236
|
return pdtBBsMap;
|
|
@@ -251,6 +266,35 @@ public:
|
|
|
251
266
|
return this->exitBB;
|
|
252
267
|
}
|
|
253
268
|
|
|
269
|
+
void getExitBlocksOfLoop(const BasicBlock* bb, Set<const BasicBlock*>& exitbbs) const
|
|
270
|
+
{
|
|
271
|
+
if (hasLoopInfo(bb))
|
|
272
|
+
{
|
|
273
|
+
const std::vector<const BasicBlock*>& blocks = getLoopInfo(bb);
|
|
274
|
+
assert(!blocks.empty() && "no available loop info?");
|
|
275
|
+
for (const BasicBlock* block : blocks)
|
|
276
|
+
{
|
|
277
|
+
for (succ_const_iterator succIt = succ_begin(block); succIt != succ_end(block); succIt++)
|
|
278
|
+
{
|
|
279
|
+
const BasicBlock* succ = *succIt;
|
|
280
|
+
if ((std::find(blocks.begin(), blocks.end(), succ)==blocks.end()))
|
|
281
|
+
exitbbs.insert(succ);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
bool isLoopHeader(const BasicBlock* bb) const
|
|
288
|
+
{
|
|
289
|
+
if (hasLoopInfo(bb))
|
|
290
|
+
{
|
|
291
|
+
const std::vector<const BasicBlock*>& blocks = getLoopInfo(bb);
|
|
292
|
+
assert(!blocks.empty() && "no available loop info?");
|
|
293
|
+
return blocks.front() == bb;
|
|
294
|
+
}
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
|
|
254
298
|
bool dominate(const BasicBlock* bbKey, const BasicBlock* bbValue) const
|
|
255
299
|
{
|
|
256
300
|
if (bbKey == bbValue)
|
|
@@ -352,7 +396,6 @@ public:
|
|
|
352
396
|
{
|
|
353
397
|
return CB;
|
|
354
398
|
}
|
|
355
|
-
using arg_iterator = User::const_op_iterator;
|
|
356
399
|
Value *getArgument(unsigned ArgNo) const
|
|
357
400
|
{
|
|
358
401
|
return CB->getArgOperand(ArgNo);
|
|
@@ -361,14 +404,6 @@ public:
|
|
|
361
404
|
{
|
|
362
405
|
return CB->getType();
|
|
363
406
|
}
|
|
364
|
-
User::const_op_iterator arg_begin() const
|
|
365
|
-
{
|
|
366
|
-
return CB->arg_begin();
|
|
367
|
-
}
|
|
368
|
-
User::const_op_iterator arg_end() const
|
|
369
|
-
{
|
|
370
|
-
return CB->arg_end();
|
|
371
|
-
}
|
|
372
407
|
unsigned arg_size() const
|
|
373
408
|
{
|
|
374
409
|
return CB->arg_size();
|
|
Binary file
|
|
@@ -162,13 +162,6 @@ public:
|
|
|
162
162
|
return keyFunc->dominate(bbKey,bbValue);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
/// Get LoopInfo
|
|
166
|
-
inline LoopInfo* getLoopInfo(const Function* f)
|
|
167
|
-
{
|
|
168
|
-
return cfInfoBuilder.getLoopInfo(f);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
165
|
/// Guard Computation for a value-flow (between two basic blocks)
|
|
173
166
|
//@{
|
|
174
167
|
virtual Condition ComputeIntraVFGGuard(const BasicBlock* src, const BasicBlock* dst);
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
|
|
27
27
|
#include <llvm/Support/SourceMgr.h>
|
|
28
28
|
|
|
29
|
+
#include "llvm/Analysis/LoopInfo.h"
|
|
30
|
+
|
|
29
31
|
namespace SVF
|
|
30
32
|
{
|
|
31
33
|
|
|
@@ -73,6 +75,11 @@ typedef llvm::DominanceFrontier DominanceFrontier;
|
|
|
73
75
|
typedef llvm::PostDominatorTree PostDominatorTree;
|
|
74
76
|
typedef llvm::DominanceFrontierBase<llvm::BasicBlock, false> DominanceFrontierBase;
|
|
75
77
|
|
|
78
|
+
/// LLVM Loop
|
|
79
|
+
typedef llvm::Loop Loop;
|
|
80
|
+
typedef llvm::LoopInfo LoopInfo;
|
|
81
|
+
typedef llvm::User User;
|
|
82
|
+
|
|
76
83
|
// LLVM Instructions
|
|
77
84
|
typedef llvm::AllocaInst AllocaInst;
|
|
78
85
|
typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
#include <llvm/BinaryFormat/Dwarf.h>
|
|
56
56
|
#endif
|
|
57
57
|
|
|
58
|
-
#include "llvm/Analysis/LoopInfo.h"
|
|
59
58
|
#include "llvm/IR/CFG.h"
|
|
60
59
|
#include "llvm/BinaryFormat/Dwarf.h"
|
|
61
60
|
|
|
@@ -74,9 +73,6 @@ typedef llvm::Instruction Instruction;
|
|
|
74
73
|
typedef llvm::CallBase CallBase;
|
|
75
74
|
typedef llvm::GlobalValue GlobalValue;
|
|
76
75
|
typedef llvm::GlobalVariable GlobalVariable;
|
|
77
|
-
typedef llvm::User User;
|
|
78
|
-
typedef llvm::Loop Loop;
|
|
79
|
-
typedef llvm::LoopInfo LoopInfo;
|
|
80
76
|
|
|
81
77
|
/// LLVM outputs
|
|
82
78
|
typedef llvm::raw_string_ostream raw_string_ostream;
|
|
@@ -129,11 +125,8 @@ private:
|
|
|
129
125
|
Map<const BasicBlock*,Set<const BasicBlock*>> dtBBsMap;
|
|
130
126
|
Map<const BasicBlock*,Set<const BasicBlock*>> dfBBsMap;
|
|
131
127
|
Map<const BasicBlock*,Set<const BasicBlock*>> pdtBBsMap;
|
|
128
|
+
Map<const BasicBlock*,std::vector<const BasicBlock*>> bb2LoopMap;
|
|
132
129
|
public:
|
|
133
|
-
SVFFunction(const std::string& val): SVFValue(val,SVFValue::SVFFunc),
|
|
134
|
-
isDecl(false), isIntri(false), fun(nullptr), exitBB(nullptr), isUncalled(false), isNotRet(false)
|
|
135
|
-
{
|
|
136
|
-
}
|
|
137
130
|
|
|
138
131
|
SVFFunction(Function* f): SVFValue(f->getName().str(),SVFValue::SVFFunc),
|
|
139
132
|
isDecl(f->isDeclaration()), isIntri(f->isIntrinsic()), fun(f), exitBB(nullptr), isUncalled(false), isNotRet(false)
|
|
@@ -216,6 +209,28 @@ public:
|
|
|
216
209
|
return dfBBsMap;
|
|
217
210
|
}
|
|
218
211
|
|
|
212
|
+
inline bool hasLoopInfo(const BasicBlock* bb) const
|
|
213
|
+
{
|
|
214
|
+
return bb2LoopMap.find(bb)!=bb2LoopMap.end();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
inline const std::vector<const BasicBlock*>& getLoopInfo(const BasicBlock* bb) const
|
|
218
|
+
{
|
|
219
|
+
Map<const BasicBlock*, std::vector<const BasicBlock*>>::const_iterator mapIter = bb2LoopMap.find(bb);
|
|
220
|
+
if(mapIter != bb2LoopMap.end())
|
|
221
|
+
return mapIter->second;
|
|
222
|
+
else
|
|
223
|
+
{
|
|
224
|
+
assert(hasLoopInfo(bb) && "loopinfo does not exit(bb not in a loop)");
|
|
225
|
+
abort();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
inline void addToBB2LoopMap(const BasicBlock* bb, const BasicBlock* loopBB)
|
|
230
|
+
{
|
|
231
|
+
bb2LoopMap[bb].push_back(loopBB);
|
|
232
|
+
}
|
|
233
|
+
|
|
219
234
|
inline const Map<const BasicBlock*,Set<const BasicBlock*>>& getPostDomTreeMap() const
|
|
220
235
|
{
|
|
221
236
|
return pdtBBsMap;
|
|
@@ -251,6 +266,35 @@ public:
|
|
|
251
266
|
return this->exitBB;
|
|
252
267
|
}
|
|
253
268
|
|
|
269
|
+
void getExitBlocksOfLoop(const BasicBlock* bb, Set<const BasicBlock*>& exitbbs) const
|
|
270
|
+
{
|
|
271
|
+
if (hasLoopInfo(bb))
|
|
272
|
+
{
|
|
273
|
+
const std::vector<const BasicBlock*>& blocks = getLoopInfo(bb);
|
|
274
|
+
assert(!blocks.empty() && "no available loop info?");
|
|
275
|
+
for (const BasicBlock* block : blocks)
|
|
276
|
+
{
|
|
277
|
+
for (succ_const_iterator succIt = succ_begin(block); succIt != succ_end(block); succIt++)
|
|
278
|
+
{
|
|
279
|
+
const BasicBlock* succ = *succIt;
|
|
280
|
+
if ((std::find(blocks.begin(), blocks.end(), succ)==blocks.end()))
|
|
281
|
+
exitbbs.insert(succ);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
bool isLoopHeader(const BasicBlock* bb) const
|
|
288
|
+
{
|
|
289
|
+
if (hasLoopInfo(bb))
|
|
290
|
+
{
|
|
291
|
+
const std::vector<const BasicBlock*>& blocks = getLoopInfo(bb);
|
|
292
|
+
assert(!blocks.empty() && "no available loop info?");
|
|
293
|
+
return blocks.front() == bb;
|
|
294
|
+
}
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
|
|
254
298
|
bool dominate(const BasicBlock* bbKey, const BasicBlock* bbValue) const
|
|
255
299
|
{
|
|
256
300
|
if (bbKey == bbValue)
|
|
@@ -352,7 +396,6 @@ public:
|
|
|
352
396
|
{
|
|
353
397
|
return CB;
|
|
354
398
|
}
|
|
355
|
-
using arg_iterator = User::const_op_iterator;
|
|
356
399
|
Value *getArgument(unsigned ArgNo) const
|
|
357
400
|
{
|
|
358
401
|
return CB->getArgOperand(ArgNo);
|
|
@@ -361,14 +404,6 @@ public:
|
|
|
361
404
|
{
|
|
362
405
|
return CB->getType();
|
|
363
406
|
}
|
|
364
|
-
User::const_op_iterator arg_begin() const
|
|
365
|
-
{
|
|
366
|
-
return CB->arg_begin();
|
|
367
|
-
}
|
|
368
|
-
User::const_op_iterator arg_end() const
|
|
369
|
-
{
|
|
370
|
-
return CB->arg_end();
|
|
371
|
-
}
|
|
372
407
|
unsigned arg_size() const
|
|
373
408
|
{
|
|
374
409
|
return CB->arg_size();
|