svf-lib 1.0.1039 → 1.0.1042
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/MemoryModel/SymbolTableInfo.h +3 -2
- package/SVF-linux/include/SVF-FE/LLVMUtil.h +13 -3
- 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/MemoryModel/SymbolTableInfo.h +3 -2
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +10 -252
- package/SVF-osx/include/Util/SVFUtil.h +255 -0
- package/package.json +1 -1
|
Binary file
|
|
@@ -88,6 +88,8 @@ private:
|
|
|
88
88
|
IDToMemMapTy objMap; ///< map a memory sym id to its obj
|
|
89
89
|
|
|
90
90
|
CallSiteSet callSiteSet;
|
|
91
|
+
Set<const Value*> nullPtrSyms;
|
|
92
|
+
Set<const Value*> blackholeSyms;
|
|
91
93
|
|
|
92
94
|
// Singleton pattern here to enable instance of SymbolTableInfo can only be created once.
|
|
93
95
|
static SymbolTableInfo* symInfo;
|
|
@@ -162,8 +164,7 @@ public:
|
|
|
162
164
|
/// special value
|
|
163
165
|
// @{
|
|
164
166
|
static bool isNullPtrSym(const Value *val);
|
|
165
|
-
|
|
166
|
-
bool isConstantObjSym(const Value *val);
|
|
167
|
+
static bool isBlackholeSym(const Value *val);
|
|
167
168
|
|
|
168
169
|
static inline bool isBlkPtr(NodeID id)
|
|
169
170
|
{
|
|
@@ -44,15 +44,25 @@ namespace SVFUtil
|
|
|
44
44
|
{
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
47
|
/// Check whether this value is a black hole
|
|
50
48
|
inline bool isBlackholeSym(const Value *val)
|
|
51
49
|
{
|
|
52
50
|
return (SVFUtil::isa<UndefValue>(val));
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
/// Check whether this value is a black hole
|
|
54
|
+
inline bool isNullPtrSym(const Value *val)
|
|
55
|
+
{
|
|
56
|
+
if (const Constant* v = SVFUtil::dyn_cast<Constant>(val))
|
|
57
|
+
{
|
|
58
|
+
return v->isNullValue() && v->getType()->isPointerTy();
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/// Check whether this value points-to a constant object
|
|
64
|
+
bool isConstantObjSym(const Value *val);
|
|
65
|
+
|
|
56
66
|
|
|
57
67
|
/// Whether an instruction is a return instruction
|
|
58
68
|
inline bool isReturn(const Instruction* inst)
|
|
Binary file
|
|
Binary file
|
|
@@ -88,6 +88,8 @@ private:
|
|
|
88
88
|
IDToMemMapTy objMap; ///< map a memory sym id to its obj
|
|
89
89
|
|
|
90
90
|
CallSiteSet callSiteSet;
|
|
91
|
+
Set<const Value*> nullPtrSyms;
|
|
92
|
+
Set<const Value*> blackholeSyms;
|
|
91
93
|
|
|
92
94
|
// Singleton pattern here to enable instance of SymbolTableInfo can only be created once.
|
|
93
95
|
static SymbolTableInfo* symInfo;
|
|
@@ -162,8 +164,7 @@ public:
|
|
|
162
164
|
/// special value
|
|
163
165
|
// @{
|
|
164
166
|
static bool isNullPtrSym(const Value *val);
|
|
165
|
-
|
|
166
|
-
bool isConstantObjSym(const Value *val);
|
|
167
|
+
static bool isBlackholeSym(const Value *val);
|
|
167
168
|
|
|
168
169
|
static inline bool isBlkPtr(NodeID id)
|
|
169
170
|
{
|
|
@@ -44,38 +44,25 @@ namespace SVFUtil
|
|
|
44
44
|
{
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
/// This function servers a allocation wrapper detector
|
|
49
|
-
inline bool isAnAllocationWraper(const Instruction*)
|
|
50
|
-
{
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/// Return LLVM function if this value is
|
|
55
|
-
inline const Function* getLLVMFunction(const Value* val)
|
|
56
|
-
{
|
|
57
|
-
const Function *fun = SVFUtil::dyn_cast<Function>(val->stripPointerCasts());
|
|
58
|
-
return fun;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
47
|
/// Check whether this value is a black hole
|
|
63
48
|
inline bool isBlackholeSym(const Value *val)
|
|
64
49
|
{
|
|
65
50
|
return (SVFUtil::isa<UndefValue>(val));
|
|
66
51
|
}
|
|
67
52
|
|
|
68
|
-
|
|
69
|
-
inline bool
|
|
53
|
+
/// Check whether this value is a black hole
|
|
54
|
+
inline bool isNullPtrSym(const Value *val)
|
|
70
55
|
{
|
|
71
|
-
|
|
56
|
+
if (const Constant* v = SVFUtil::dyn_cast<Constant>(val))
|
|
57
|
+
{
|
|
58
|
+
return v->isNullValue() && v->getType()->isPointerTy();
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
72
61
|
}
|
|
73
62
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
//@}
|
|
63
|
+
/// Check whether this value points-to a constant object
|
|
64
|
+
bool isConstantObjSym(const Value *val);
|
|
65
|
+
|
|
79
66
|
|
|
80
67
|
/// Whether an instruction is a return instruction
|
|
81
68
|
inline bool isReturn(const Instruction* inst)
|
|
@@ -93,101 +80,6 @@ static inline Type *getPtrElementType(const PointerType* pty)
|
|
|
93
80
|
#endif
|
|
94
81
|
}
|
|
95
82
|
|
|
96
|
-
/// interfaces to be used externally
|
|
97
|
-
inline bool isHeapAllocExtCallViaRet(const CallSite cs)
|
|
98
|
-
{
|
|
99
|
-
bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
|
|
100
|
-
return isPtrTy && isHeapAllocExtFunViaRet(getCallee(cs));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
inline bool isHeapAllocExtCallViaRet(const Instruction *inst)
|
|
104
|
-
{
|
|
105
|
-
bool isPtrTy = inst->getType()->isPointerTy();
|
|
106
|
-
return isPtrTy && isHeapAllocExtFunViaRet(getCallee(inst));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
inline bool isHeapAllocExtCallViaArg(const CallSite cs)
|
|
110
|
-
{
|
|
111
|
-
return isHeapAllocExtFunViaArg(getCallee(cs));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
inline bool isHeapAllocExtCallViaArg(const Instruction *inst)
|
|
115
|
-
{
|
|
116
|
-
return isHeapAllocExtFunViaArg(getCallee(inst));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
inline bool isHeapAllocExtCall(const CallSite cs)
|
|
120
|
-
{
|
|
121
|
-
return isHeapAllocExtCallViaRet(cs) || isHeapAllocExtCallViaArg(cs);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
inline bool isHeapAllocExtCall(const Instruction *inst)
|
|
125
|
-
{
|
|
126
|
-
return isHeapAllocExtCallViaRet(inst) || isHeapAllocExtCallViaArg(inst);
|
|
127
|
-
}
|
|
128
|
-
//@}
|
|
129
|
-
|
|
130
|
-
inline int getHeapAllocHoldingArgPosition(const CallSite cs)
|
|
131
|
-
{
|
|
132
|
-
return getHeapAllocHoldingArgPosition(getCallee(cs));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
inline int getHeapAllocHoldingArgPosition(const Instruction *inst)
|
|
136
|
-
{
|
|
137
|
-
return getHeapAllocHoldingArgPosition(getCallee(inst));
|
|
138
|
-
}
|
|
139
|
-
//@}
|
|
140
|
-
|
|
141
|
-
inline bool isReallocExtCall(const CallSite cs)
|
|
142
|
-
{
|
|
143
|
-
bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
|
|
144
|
-
return isPtrTy && isReallocExtFun(getCallee(cs));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
inline bool isReallocExtCall(const Instruction *inst)
|
|
148
|
-
{
|
|
149
|
-
bool isPtrTy = inst->getType()->isPointerTy();
|
|
150
|
-
return isPtrTy && isReallocExtFun(getCallee(inst));
|
|
151
|
-
}
|
|
152
|
-
//@}
|
|
153
|
-
|
|
154
|
-
inline bool isDeallocExtCall(const CallSite cs)
|
|
155
|
-
{
|
|
156
|
-
return isDeallocExtFun(getCallee(cs));
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
inline bool isDeallocExtCall(const Instruction *inst)
|
|
160
|
-
{
|
|
161
|
-
return isDeallocExtFun(getCallee(inst));
|
|
162
|
-
}
|
|
163
|
-
//@}
|
|
164
|
-
|
|
165
|
-
inline bool isStaticExtCall(const CallSite cs)
|
|
166
|
-
{
|
|
167
|
-
bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
|
|
168
|
-
return isPtrTy && isStaticExtFun(getCallee(cs));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
inline bool isStaticExtCall(const Instruction *inst)
|
|
172
|
-
{
|
|
173
|
-
bool isPtrTy = inst->getType()->isPointerTy();
|
|
174
|
-
return isPtrTy && isStaticExtFun(getCallee(inst));
|
|
175
|
-
}
|
|
176
|
-
//@}
|
|
177
|
-
|
|
178
|
-
/// Return true if the call is a static global call
|
|
179
|
-
//@{
|
|
180
|
-
inline bool isHeapAllocOrStaticExtCall(const CallSite cs)
|
|
181
|
-
{
|
|
182
|
-
return isStaticExtCall(cs) || isHeapAllocExtCall(cs);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
inline bool isHeapAllocOrStaticExtCall(const Instruction *inst)
|
|
186
|
-
{
|
|
187
|
-
return isStaticExtCall(inst) || isHeapAllocExtCall(inst);
|
|
188
|
-
}
|
|
189
|
-
//@}
|
|
190
|
-
|
|
191
83
|
/// Get the reference type of heap/static object from an allocation site.
|
|
192
84
|
//@{
|
|
193
85
|
inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallSite cs)
|
|
@@ -219,126 +111,6 @@ inline const PointerType *getRefTypeOfHeapAllocOrStatic(const Instruction *inst)
|
|
|
219
111
|
}
|
|
220
112
|
//@}
|
|
221
113
|
|
|
222
|
-
/// Return true if this is a thread creation call
|
|
223
|
-
///@{
|
|
224
|
-
inline bool isThreadForkCall(const CallSite cs)
|
|
225
|
-
{
|
|
226
|
-
return ThreadAPI::getThreadAPI()->isTDFork(cs);
|
|
227
|
-
}
|
|
228
|
-
inline bool isThreadForkCall(const Instruction *inst)
|
|
229
|
-
{
|
|
230
|
-
return ThreadAPI::getThreadAPI()->isTDFork(inst);
|
|
231
|
-
}
|
|
232
|
-
//@}
|
|
233
|
-
|
|
234
|
-
/// Return true if this is a hare_parallel_for call
|
|
235
|
-
///@{
|
|
236
|
-
inline bool isHareParForCall(const CallSite cs)
|
|
237
|
-
{
|
|
238
|
-
return ThreadAPI::getThreadAPI()->isHareParFor(cs);
|
|
239
|
-
}
|
|
240
|
-
inline bool isHareParForCall(const Instruction *inst)
|
|
241
|
-
{
|
|
242
|
-
return ThreadAPI::getThreadAPI()->isHareParFor(inst);
|
|
243
|
-
}
|
|
244
|
-
//@}
|
|
245
|
-
|
|
246
|
-
/// Return true if this is a thread join call
|
|
247
|
-
///@{
|
|
248
|
-
inline bool isThreadJoinCall(const CallSite cs)
|
|
249
|
-
{
|
|
250
|
-
return ThreadAPI::getThreadAPI()->isTDJoin(cs);
|
|
251
|
-
}
|
|
252
|
-
inline bool isThreadJoinCall(const Instruction *inst)
|
|
253
|
-
{
|
|
254
|
-
return ThreadAPI::getThreadAPI()->isTDJoin(inst);
|
|
255
|
-
}
|
|
256
|
-
//@}
|
|
257
|
-
|
|
258
|
-
/// Return true if this is a thread exit call
|
|
259
|
-
///@{
|
|
260
|
-
inline bool isThreadExitCall(const CallSite cs)
|
|
261
|
-
{
|
|
262
|
-
return ThreadAPI::getThreadAPI()->isTDExit(cs);
|
|
263
|
-
}
|
|
264
|
-
inline bool isThreadExitCall(const Instruction *inst)
|
|
265
|
-
{
|
|
266
|
-
return ThreadAPI::getThreadAPI()->isTDExit(inst);
|
|
267
|
-
}
|
|
268
|
-
//@}
|
|
269
|
-
|
|
270
|
-
/// Return true if this is a lock acquire call
|
|
271
|
-
///@{
|
|
272
|
-
inline bool isLockAquireCall(const CallSite cs)
|
|
273
|
-
{
|
|
274
|
-
return ThreadAPI::getThreadAPI()->isTDAcquire(cs);
|
|
275
|
-
}
|
|
276
|
-
inline bool isLockAquireCall(const Instruction *inst)
|
|
277
|
-
{
|
|
278
|
-
return ThreadAPI::getThreadAPI()->isTDAcquire(inst);
|
|
279
|
-
}
|
|
280
|
-
//@}
|
|
281
|
-
|
|
282
|
-
/// Return true if this is a lock acquire call
|
|
283
|
-
///@{
|
|
284
|
-
inline bool isLockReleaseCall(const CallSite cs)
|
|
285
|
-
{
|
|
286
|
-
return ThreadAPI::getThreadAPI()->isTDRelease(cs);
|
|
287
|
-
}
|
|
288
|
-
inline bool isLockReleaseCall(const Instruction *inst)
|
|
289
|
-
{
|
|
290
|
-
return ThreadAPI::getThreadAPI()->isTDRelease(inst);
|
|
291
|
-
}
|
|
292
|
-
//@}
|
|
293
|
-
|
|
294
|
-
/// Return true if this is a barrier wait call
|
|
295
|
-
//@{
|
|
296
|
-
inline bool isBarrierWaitCall(const CallSite cs)
|
|
297
|
-
{
|
|
298
|
-
return ThreadAPI::getThreadAPI()->isTDBarWait(cs);
|
|
299
|
-
}
|
|
300
|
-
inline bool isBarrierWaitCall(const Instruction *inst)
|
|
301
|
-
{
|
|
302
|
-
return ThreadAPI::getThreadAPI()->isTDBarWait(inst);
|
|
303
|
-
}
|
|
304
|
-
//@}
|
|
305
|
-
|
|
306
|
-
/// Return sole argument of the thread routine
|
|
307
|
-
//@{
|
|
308
|
-
inline const Value* getActualParmAtForkSite(const CallSite cs)
|
|
309
|
-
{
|
|
310
|
-
return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs);
|
|
311
|
-
}
|
|
312
|
-
inline const Value* getActualParmAtForkSite(const Instruction *inst)
|
|
313
|
-
{
|
|
314
|
-
return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(inst);
|
|
315
|
-
}
|
|
316
|
-
//@}
|
|
317
|
-
|
|
318
|
-
/// Return the task function of the parallel_for routine
|
|
319
|
-
//@{
|
|
320
|
-
inline const Value* getTaskFuncAtHareParForSite(const CallSite cs)
|
|
321
|
-
{
|
|
322
|
-
return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(cs);
|
|
323
|
-
}
|
|
324
|
-
inline const Value* getTaskFuncAtHareParForSite(const Instruction *inst)
|
|
325
|
-
{
|
|
326
|
-
return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(inst);
|
|
327
|
-
}
|
|
328
|
-
//@}
|
|
329
|
-
|
|
330
|
-
/// Return the task data argument of the parallel_for rountine
|
|
331
|
-
//@{
|
|
332
|
-
inline const Value* getTaskDataAtHareParForSite(const CallSite cs)
|
|
333
|
-
{
|
|
334
|
-
return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(cs);
|
|
335
|
-
}
|
|
336
|
-
inline const Value* getTaskDataAtHareParForSite(const Instruction *inst)
|
|
337
|
-
{
|
|
338
|
-
return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(inst);
|
|
339
|
-
}
|
|
340
|
-
//@}
|
|
341
|
-
|
|
342
114
|
/// Return true if this value refers to a object
|
|
343
115
|
bool isObject (const Value * ref);
|
|
344
116
|
|
|
@@ -356,11 +128,6 @@ inline bool ArgInDeadFunction (const Value * val)
|
|
|
356
128
|
}
|
|
357
129
|
//@}
|
|
358
130
|
|
|
359
|
-
inline bool isProgEntryFunction (const Function * fun)
|
|
360
|
-
{
|
|
361
|
-
return fun && fun->getName() == "main";
|
|
362
|
-
}
|
|
363
|
-
|
|
364
131
|
/// Return true if this is an argument of a program entry function (e.g. main)
|
|
365
132
|
inline bool ArgInProgEntryFunction (const Value * val)
|
|
366
133
|
{
|
|
@@ -371,15 +138,6 @@ inline bool ArgInProgEntryFunction (const Value * val)
|
|
|
371
138
|
bool isPtrInDeadFunction (const Value * value);
|
|
372
139
|
//@}
|
|
373
140
|
|
|
374
|
-
inline bool isProgExitCall(const CallSite cs)
|
|
375
|
-
{
|
|
376
|
-
return isProgExitFunction(getCallee(cs));
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
inline bool isProgExitCall(const Instruction *inst)
|
|
380
|
-
{
|
|
381
|
-
return isProgExitFunction(getCallee(inst));
|
|
382
|
-
}
|
|
383
141
|
//@}
|
|
384
142
|
|
|
385
143
|
/// Function does not have any possible caller in the call graph
|
|
@@ -476,6 +476,261 @@ inline const Value* getForkedFun(const Instruction *inst)
|
|
|
476
476
|
|
|
477
477
|
const std::string type2String(const Type* type);
|
|
478
478
|
|
|
479
|
+
/// This function servers a allocation wrapper detector
|
|
480
|
+
inline bool isAnAllocationWraper(const Instruction*)
|
|
481
|
+
{
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/// Return LLVM function if this value is
|
|
486
|
+
inline const Function* getLLVMFunction(const Value* val)
|
|
487
|
+
{
|
|
488
|
+
const Function *fun = SVFUtil::dyn_cast<Function>(val->stripPointerCasts());
|
|
489
|
+
return fun;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
inline bool isExtCall(const CallSite cs)
|
|
493
|
+
{
|
|
494
|
+
return isExtCall(getCallee(cs));
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
inline bool isExtCall(const Instruction *inst)
|
|
498
|
+
{
|
|
499
|
+
return isExtCall(getCallee(inst));
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
inline bool isHeapAllocExtCallViaArg(const CallSite cs)
|
|
503
|
+
{
|
|
504
|
+
return isHeapAllocExtFunViaArg(getCallee(cs));
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
inline bool isHeapAllocExtCallViaArg(const Instruction *inst)
|
|
508
|
+
{
|
|
509
|
+
return isHeapAllocExtFunViaArg(getCallee(inst));
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/// interfaces to be used externally
|
|
513
|
+
inline bool isHeapAllocExtCallViaRet(const CallSite cs)
|
|
514
|
+
{
|
|
515
|
+
bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
|
|
516
|
+
return isPtrTy && isHeapAllocExtFunViaRet(getCallee(cs));
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
inline bool isHeapAllocExtCallViaRet(const Instruction *inst)
|
|
520
|
+
{
|
|
521
|
+
bool isPtrTy = inst->getType()->isPointerTy();
|
|
522
|
+
return isPtrTy && isHeapAllocExtFunViaRet(getCallee(inst));
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
inline bool isHeapAllocExtCall(const CallSite cs)
|
|
526
|
+
{
|
|
527
|
+
return isHeapAllocExtCallViaRet(cs) || isHeapAllocExtCallViaArg(cs);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
inline bool isHeapAllocExtCall(const Instruction *inst)
|
|
531
|
+
{
|
|
532
|
+
return isHeapAllocExtCallViaRet(inst) || isHeapAllocExtCallViaArg(inst);
|
|
533
|
+
}
|
|
534
|
+
//@}
|
|
535
|
+
|
|
536
|
+
inline int getHeapAllocHoldingArgPosition(const CallSite cs)
|
|
537
|
+
{
|
|
538
|
+
return getHeapAllocHoldingArgPosition(getCallee(cs));
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
inline int getHeapAllocHoldingArgPosition(const Instruction *inst)
|
|
542
|
+
{
|
|
543
|
+
return getHeapAllocHoldingArgPosition(getCallee(inst));
|
|
544
|
+
}
|
|
545
|
+
//@}
|
|
546
|
+
|
|
547
|
+
inline bool isReallocExtCall(const CallSite cs)
|
|
548
|
+
{
|
|
549
|
+
bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
|
|
550
|
+
return isPtrTy && isReallocExtFun(getCallee(cs));
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
inline bool isReallocExtCall(const Instruction *inst)
|
|
554
|
+
{
|
|
555
|
+
bool isPtrTy = inst->getType()->isPointerTy();
|
|
556
|
+
return isPtrTy && isReallocExtFun(getCallee(inst));
|
|
557
|
+
}
|
|
558
|
+
//@}
|
|
559
|
+
|
|
560
|
+
inline bool isDeallocExtCall(const CallSite cs)
|
|
561
|
+
{
|
|
562
|
+
return isDeallocExtFun(getCallee(cs));
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
inline bool isDeallocExtCall(const Instruction *inst)
|
|
566
|
+
{
|
|
567
|
+
return isDeallocExtFun(getCallee(inst));
|
|
568
|
+
}
|
|
569
|
+
//@}
|
|
570
|
+
|
|
571
|
+
inline bool isStaticExtCall(const CallSite cs)
|
|
572
|
+
{
|
|
573
|
+
bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
|
|
574
|
+
return isPtrTy && isStaticExtFun(getCallee(cs));
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
inline bool isStaticExtCall(const Instruction *inst)
|
|
578
|
+
{
|
|
579
|
+
bool isPtrTy = inst->getType()->isPointerTy();
|
|
580
|
+
return isPtrTy && isStaticExtFun(getCallee(inst));
|
|
581
|
+
}
|
|
582
|
+
//@}
|
|
583
|
+
|
|
584
|
+
/// Return true if the call is a static global call
|
|
585
|
+
//@{
|
|
586
|
+
inline bool isHeapAllocOrStaticExtCall(const CallSite cs)
|
|
587
|
+
{
|
|
588
|
+
return isStaticExtCall(cs) || isHeapAllocExtCall(cs);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
inline bool isHeapAllocOrStaticExtCall(const Instruction *inst)
|
|
592
|
+
{
|
|
593
|
+
return isStaticExtCall(inst) || isHeapAllocExtCall(inst);
|
|
594
|
+
}
|
|
595
|
+
//@}
|
|
596
|
+
|
|
597
|
+
/// Return true if this is a thread creation call
|
|
598
|
+
///@{
|
|
599
|
+
inline bool isThreadForkCall(const CallSite cs)
|
|
600
|
+
{
|
|
601
|
+
return ThreadAPI::getThreadAPI()->isTDFork(cs);
|
|
602
|
+
}
|
|
603
|
+
inline bool isThreadForkCall(const Instruction *inst)
|
|
604
|
+
{
|
|
605
|
+
return ThreadAPI::getThreadAPI()->isTDFork(inst);
|
|
606
|
+
}
|
|
607
|
+
//@}
|
|
608
|
+
|
|
609
|
+
/// Return true if this is a hare_parallel_for call
|
|
610
|
+
///@{
|
|
611
|
+
inline bool isHareParForCall(const CallSite cs)
|
|
612
|
+
{
|
|
613
|
+
return ThreadAPI::getThreadAPI()->isHareParFor(cs);
|
|
614
|
+
}
|
|
615
|
+
inline bool isHareParForCall(const Instruction *inst)
|
|
616
|
+
{
|
|
617
|
+
return ThreadAPI::getThreadAPI()->isHareParFor(inst);
|
|
618
|
+
}
|
|
619
|
+
//@}
|
|
620
|
+
|
|
621
|
+
/// Return true if this is a thread join call
|
|
622
|
+
///@{
|
|
623
|
+
inline bool isThreadJoinCall(const CallSite cs)
|
|
624
|
+
{
|
|
625
|
+
return ThreadAPI::getThreadAPI()->isTDJoin(cs);
|
|
626
|
+
}
|
|
627
|
+
inline bool isThreadJoinCall(const Instruction *inst)
|
|
628
|
+
{
|
|
629
|
+
return ThreadAPI::getThreadAPI()->isTDJoin(inst);
|
|
630
|
+
}
|
|
631
|
+
//@}
|
|
632
|
+
|
|
633
|
+
/// Return true if this is a thread exit call
|
|
634
|
+
///@{
|
|
635
|
+
inline bool isThreadExitCall(const CallSite cs)
|
|
636
|
+
{
|
|
637
|
+
return ThreadAPI::getThreadAPI()->isTDExit(cs);
|
|
638
|
+
}
|
|
639
|
+
inline bool isThreadExitCall(const Instruction *inst)
|
|
640
|
+
{
|
|
641
|
+
return ThreadAPI::getThreadAPI()->isTDExit(inst);
|
|
642
|
+
}
|
|
643
|
+
//@}
|
|
644
|
+
|
|
645
|
+
/// Return true if this is a lock acquire call
|
|
646
|
+
///@{
|
|
647
|
+
inline bool isLockAquireCall(const CallSite cs)
|
|
648
|
+
{
|
|
649
|
+
return ThreadAPI::getThreadAPI()->isTDAcquire(cs);
|
|
650
|
+
}
|
|
651
|
+
inline bool isLockAquireCall(const Instruction *inst)
|
|
652
|
+
{
|
|
653
|
+
return ThreadAPI::getThreadAPI()->isTDAcquire(inst);
|
|
654
|
+
}
|
|
655
|
+
//@}
|
|
656
|
+
|
|
657
|
+
/// Return true if this is a lock acquire call
|
|
658
|
+
///@{
|
|
659
|
+
inline bool isLockReleaseCall(const CallSite cs)
|
|
660
|
+
{
|
|
661
|
+
return ThreadAPI::getThreadAPI()->isTDRelease(cs);
|
|
662
|
+
}
|
|
663
|
+
inline bool isLockReleaseCall(const Instruction *inst)
|
|
664
|
+
{
|
|
665
|
+
return ThreadAPI::getThreadAPI()->isTDRelease(inst);
|
|
666
|
+
}
|
|
667
|
+
//@}
|
|
668
|
+
|
|
669
|
+
/// Return true if this is a barrier wait call
|
|
670
|
+
//@{
|
|
671
|
+
inline bool isBarrierWaitCall(const CallSite cs)
|
|
672
|
+
{
|
|
673
|
+
return ThreadAPI::getThreadAPI()->isTDBarWait(cs);
|
|
674
|
+
}
|
|
675
|
+
inline bool isBarrierWaitCall(const Instruction *inst)
|
|
676
|
+
{
|
|
677
|
+
return ThreadAPI::getThreadAPI()->isTDBarWait(inst);
|
|
678
|
+
}
|
|
679
|
+
//@}
|
|
680
|
+
|
|
681
|
+
/// Return sole argument of the thread routine
|
|
682
|
+
//@{
|
|
683
|
+
inline const Value* getActualParmAtForkSite(const CallSite cs)
|
|
684
|
+
{
|
|
685
|
+
return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs);
|
|
686
|
+
}
|
|
687
|
+
inline const Value* getActualParmAtForkSite(const Instruction *inst)
|
|
688
|
+
{
|
|
689
|
+
return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(inst);
|
|
690
|
+
}
|
|
691
|
+
//@}
|
|
692
|
+
|
|
693
|
+
/// Return the task function of the parallel_for routine
|
|
694
|
+
//@{
|
|
695
|
+
inline const Value* getTaskFuncAtHareParForSite(const CallSite cs)
|
|
696
|
+
{
|
|
697
|
+
return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(cs);
|
|
698
|
+
}
|
|
699
|
+
inline const Value* getTaskFuncAtHareParForSite(const Instruction *inst)
|
|
700
|
+
{
|
|
701
|
+
return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(inst);
|
|
702
|
+
}
|
|
703
|
+
//@}
|
|
704
|
+
|
|
705
|
+
/// Return the task data argument of the parallel_for rountine
|
|
706
|
+
//@{
|
|
707
|
+
inline const Value* getTaskDataAtHareParForSite(const CallSite cs)
|
|
708
|
+
{
|
|
709
|
+
return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(cs);
|
|
710
|
+
}
|
|
711
|
+
inline const Value* getTaskDataAtHareParForSite(const Instruction *inst)
|
|
712
|
+
{
|
|
713
|
+
return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(inst);
|
|
714
|
+
}
|
|
715
|
+
//@}
|
|
716
|
+
|
|
717
|
+
inline bool isProgEntryFunction (const Function * fun)
|
|
718
|
+
{
|
|
719
|
+
return fun && fun->getName() == "main";
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
inline bool isProgExitCall(const CallSite cs)
|
|
724
|
+
{
|
|
725
|
+
return isProgExitFunction(getCallee(cs));
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
inline bool isProgExitCall(const Instruction *inst)
|
|
729
|
+
{
|
|
730
|
+
return isProgExitFunction(getCallee(inst));
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
|
|
479
734
|
} // End namespace SVFUtil
|
|
480
735
|
|
|
481
736
|
} // End namespace SVF
|