svf-lib 1.0.1037 → 1.0.1040

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.
@@ -45,19 +45,6 @@ namespace SVFUtil
45
45
 
46
46
 
47
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
48
 
62
49
  /// Check whether this value is a black hole
63
50
  inline bool isBlackholeSym(const Value *val)
@@ -65,16 +52,6 @@ inline bool isBlackholeSym(const Value *val)
65
52
  return (SVFUtil::isa<UndefValue>(val));
66
53
  }
67
54
 
68
-
69
- inline bool isExtCall(const CallSite cs)
70
- {
71
- return isExtCall(getCallee(cs));
72
- }
73
-
74
- inline bool isExtCall(const Instruction *inst)
75
- {
76
- return isExtCall(getCallee(inst));
77
- }
78
55
  //@}
79
56
 
80
57
  /// Whether an instruction is a return instruction
@@ -93,101 +70,6 @@ static inline Type *getPtrElementType(const PointerType* pty)
93
70
  #endif
94
71
  }
95
72
 
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
73
  /// Get the reference type of heap/static object from an allocation site.
192
74
  //@{
193
75
  inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallSite cs)
@@ -219,126 +101,6 @@ inline const PointerType *getRefTypeOfHeapAllocOrStatic(const Instruction *inst)
219
101
  }
220
102
  //@}
221
103
 
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
104
  /// Return true if this value refers to a object
343
105
  bool isObject (const Value * ref);
344
106
 
@@ -356,11 +118,6 @@ inline bool ArgInDeadFunction (const Value * val)
356
118
  }
357
119
  //@}
358
120
 
359
- inline bool isProgEntryFunction (const Function * fun)
360
- {
361
- return fun && fun->getName() == "main";
362
- }
363
-
364
121
  /// Return true if this is an argument of a program entry function (e.g. main)
365
122
  inline bool ArgInProgEntryFunction (const Value * val)
366
123
  {
@@ -371,15 +128,6 @@ inline bool ArgInProgEntryFunction (const Value * val)
371
128
  bool isPtrInDeadFunction (const Value * value);
372
129
  //@}
373
130
 
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
131
  //@}
384
132
 
385
133
  /// 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
Binary file
@@ -57,6 +57,7 @@ typedef llvm::ConstantDataSequential ConstantDataSequential;
57
57
  typedef llvm::ConstantExpr ConstantExpr;
58
58
  typedef llvm::ConstantDataArray ConstantDataArray;
59
59
  typedef llvm::ConstantData ConstantData;
60
+ typedef llvm::ConstantArray ConstantArray;
60
61
 
61
62
  // LLVM Instructions
62
63
  typedef llvm::AllocaInst AllocaInst;
@@ -5,7 +5,7 @@
5
5
  #include "Graphs/ICFG.h"
6
6
  #include "Graphs/ICFGNode.h"
7
7
  #include "Graphs/ICFGEdge.h"
8
- #include "SVF-FE/LLVMUtil.h"
8
+ #include "Util/SVFUtil.h"
9
9
 
10
10
  namespace SVF
11
11
  {
@@ -45,19 +45,6 @@ namespace SVFUtil
45
45
 
46
46
 
47
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
48
 
62
49
  /// Check whether this value is a black hole
63
50
  inline bool isBlackholeSym(const Value *val)
@@ -65,24 +52,6 @@ inline bool isBlackholeSym(const Value *val)
65
52
  return (SVFUtil::isa<UndefValue>(val));
66
53
  }
67
54
 
68
-
69
- /// Return true if the call is an external call (external library in function summary table)
70
- /// If the libary function is redefined in the application code (e.g., memcpy), it will return false and will not be treated as an external call.
71
- //@{
72
- inline bool isExtCall(const SVFFunction* fun)
73
- {
74
- return fun && ExtAPI::getExtAPI()->is_ext(fun);
75
- }
76
-
77
- inline bool isExtCall(const CallSite cs)
78
- {
79
- return isExtCall(getCallee(cs));
80
- }
81
-
82
- inline bool isExtCall(const Instruction *inst)
83
- {
84
- return isExtCall(getCallee(inst));
85
- }
86
55
  //@}
87
56
 
88
57
  /// Whether an instruction is a return instruction
@@ -91,19 +60,6 @@ inline bool isReturn(const Instruction* inst)
91
60
  return SVFUtil::isa<ReturnInst>(inst);
92
61
  }
93
62
 
94
- /// Return true if the call is a heap allocator/reallocator
95
- //@{
96
- /// note that these two functions are not suppose to be used externally
97
- inline bool isHeapAllocExtFunViaRet(const SVFFunction* fun)
98
- {
99
- return fun && (ExtAPI::getExtAPI()->is_alloc(fun)
100
- || ExtAPI::getExtAPI()->is_realloc(fun));
101
- }
102
- inline bool isHeapAllocExtFunViaArg(const SVFFunction* fun)
103
- {
104
- return fun && ExtAPI::getExtAPI()->is_arg_alloc(fun);
105
- }
106
-
107
63
  static inline Type *getPtrElementType(const PointerType* pty)
108
64
  {
109
65
  #if (LLVM_VERSION_MAJOR < 14)
@@ -114,139 +70,6 @@ static inline Type *getPtrElementType(const PointerType* pty)
114
70
  #endif
115
71
  }
116
72
 
117
- /// interfaces to be used externally
118
- inline bool isHeapAllocExtCallViaRet(const CallSite cs)
119
- {
120
- bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
121
- return isPtrTy && isHeapAllocExtFunViaRet(getCallee(cs));
122
- }
123
-
124
- inline bool isHeapAllocExtCallViaRet(const Instruction *inst)
125
- {
126
- bool isPtrTy = inst->getType()->isPointerTy();
127
- return isPtrTy && isHeapAllocExtFunViaRet(getCallee(inst));
128
- }
129
-
130
- inline bool isHeapAllocExtCallViaArg(const CallSite cs)
131
- {
132
- return isHeapAllocExtFunViaArg(getCallee(cs));
133
- }
134
-
135
- inline bool isHeapAllocExtCallViaArg(const Instruction *inst)
136
- {
137
- return isHeapAllocExtFunViaArg(getCallee(inst));
138
- }
139
-
140
- inline bool isHeapAllocExtCall(const CallSite cs)
141
- {
142
- return isHeapAllocExtCallViaRet(cs) || isHeapAllocExtCallViaArg(cs);
143
- }
144
-
145
- inline bool isHeapAllocExtCall(const Instruction *inst)
146
- {
147
- return isHeapAllocExtCallViaRet(inst) || isHeapAllocExtCallViaArg(inst);
148
- }
149
- //@}
150
-
151
- /// Get the position of argument that holds an allocated heap object.
152
- //@{
153
- inline int getHeapAllocHoldingArgPosition(const SVFFunction* fun)
154
- {
155
- return ExtAPI::getExtAPI()->get_alloc_arg_pos(fun);
156
- }
157
-
158
- inline int getHeapAllocHoldingArgPosition(const CallSite cs)
159
- {
160
- return getHeapAllocHoldingArgPosition(getCallee(cs));
161
- }
162
-
163
- inline int getHeapAllocHoldingArgPosition(const Instruction *inst)
164
- {
165
- return getHeapAllocHoldingArgPosition(getCallee(inst));
166
- }
167
- //@}
168
-
169
- /// Return true if the call is a heap reallocator
170
- //@{
171
- /// note that this function is not suppose to be used externally
172
- inline bool isReallocExtFun(const SVFFunction* fun)
173
- {
174
- return fun && (ExtAPI::getExtAPI()->is_realloc(fun));
175
- }
176
-
177
- inline bool isReallocExtCall(const CallSite cs)
178
- {
179
- bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
180
- return isPtrTy && isReallocExtFun(getCallee(cs));
181
- }
182
-
183
- inline bool isReallocExtCall(const Instruction *inst)
184
- {
185
- bool isPtrTy = inst->getType()->isPointerTy();
186
- return isPtrTy && isReallocExtFun(getCallee(inst));
187
- }
188
- //@}
189
-
190
- /// Return true if the call is a heap dealloc or not
191
- //@{
192
- /// note that this function is not suppose to be used externally
193
- inline bool isDeallocExtFun(const SVFFunction* fun)
194
- {
195
- return fun && (ExtAPI::getExtAPI()->is_dealloc(fun));
196
- }
197
-
198
- inline bool isDeallocExtCall(const CallSite cs)
199
- {
200
- return isDeallocExtFun(getCallee(cs));
201
- }
202
-
203
- inline bool isDeallocExtCall(const Instruction *inst)
204
- {
205
- return isDeallocExtFun(getCallee(inst));
206
- }
207
- //@}
208
-
209
-
210
- /// Return true if the call is a static global call
211
- //@{
212
- /// note that this function is not suppose to be used externally
213
- inline bool isStaticExtFun(const SVFFunction* fun)
214
- {
215
- return fun && ExtAPI::getExtAPI()->has_static(fun);
216
- }
217
-
218
- inline bool isStaticExtCall(const CallSite cs)
219
- {
220
- bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
221
- return isPtrTy && isStaticExtFun(getCallee(cs));
222
- }
223
-
224
- inline bool isStaticExtCall(const Instruction *inst)
225
- {
226
- bool isPtrTy = inst->getType()->isPointerTy();
227
- return isPtrTy && isStaticExtFun(getCallee(inst));
228
- }
229
- //@}
230
-
231
- /// Return true if the call is a static global call
232
- //@{
233
- inline bool isHeapAllocOrStaticExtCall(const CallSite cs)
234
- {
235
- return isStaticExtCall(cs) || isHeapAllocExtCall(cs);
236
- }
237
-
238
- inline bool isHeapAllocOrStaticExtCall(const Instruction *inst)
239
- {
240
- return isStaticExtCall(inst) || isHeapAllocExtCall(inst);
241
- }
242
- //@}
243
-
244
- /// Return external call type
245
- inline ExtAPI::extf_t extCallTy(const SVFFunction* fun)
246
- {
247
- return ExtAPI::getExtAPI()->get_type(fun);
248
- }
249
-
250
73
  /// Get the reference type of heap/static object from an allocation site.
251
74
  //@{
252
75
  inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallSite cs)
@@ -278,150 +101,9 @@ inline const PointerType *getRefTypeOfHeapAllocOrStatic(const Instruction *inst)
278
101
  }
279
102
  //@}
280
103
 
281
- /// Return true if this is a thread creation call
282
- ///@{
283
- inline bool isThreadForkCall(const CallSite cs)
284
- {
285
- return ThreadAPI::getThreadAPI()->isTDFork(cs);
286
- }
287
- inline bool isThreadForkCall(const Instruction *inst)
288
- {
289
- return ThreadAPI::getThreadAPI()->isTDFork(inst);
290
- }
291
- //@}
292
-
293
- /// Return true if this is a hare_parallel_for call
294
- ///@{
295
- inline bool isHareParForCall(const CallSite cs)
296
- {
297
- return ThreadAPI::getThreadAPI()->isHareParFor(cs);
298
- }
299
- inline bool isHareParForCall(const Instruction *inst)
300
- {
301
- return ThreadAPI::getThreadAPI()->isHareParFor(inst);
302
- }
303
- //@}
304
-
305
- /// Return true if this is a thread join call
306
- ///@{
307
- inline bool isThreadJoinCall(const CallSite cs)
308
- {
309
- return ThreadAPI::getThreadAPI()->isTDJoin(cs);
310
- }
311
- inline bool isThreadJoinCall(const Instruction *inst)
312
- {
313
- return ThreadAPI::getThreadAPI()->isTDJoin(inst);
314
- }
315
- //@}
316
-
317
- /// Return true if this is a thread exit call
318
- ///@{
319
- inline bool isThreadExitCall(const CallSite cs)
320
- {
321
- return ThreadAPI::getThreadAPI()->isTDExit(cs);
322
- }
323
- inline bool isThreadExitCall(const Instruction *inst)
324
- {
325
- return ThreadAPI::getThreadAPI()->isTDExit(inst);
326
- }
327
- //@}
328
-
329
- /// Return true if this is a lock acquire call
330
- ///@{
331
- inline bool isLockAquireCall(const CallSite cs)
332
- {
333
- return ThreadAPI::getThreadAPI()->isTDAcquire(cs);
334
- }
335
- inline bool isLockAquireCall(const Instruction *inst)
336
- {
337
- return ThreadAPI::getThreadAPI()->isTDAcquire(inst);
338
- }
339
- //@}
340
-
341
- /// Return true if this is a lock acquire call
342
- ///@{
343
- inline bool isLockReleaseCall(const CallSite cs)
344
- {
345
- return ThreadAPI::getThreadAPI()->isTDRelease(cs);
346
- }
347
- inline bool isLockReleaseCall(const Instruction *inst)
348
- {
349
- return ThreadAPI::getThreadAPI()->isTDRelease(inst);
350
- }
351
- //@}
352
-
353
- /// Return true if this is a barrier wait call
354
- //@{
355
- inline bool isBarrierWaitCall(const CallSite cs)
356
- {
357
- return ThreadAPI::getThreadAPI()->isTDBarWait(cs);
358
- }
359
- inline bool isBarrierWaitCall(const Instruction *inst)
360
- {
361
- return ThreadAPI::getThreadAPI()->isTDBarWait(inst);
362
- }
363
- //@}
364
-
365
- /// Return thread fork function
366
- //@{
367
- inline const Value* getForkedFun(const CallSite cs)
368
- {
369
- return ThreadAPI::getThreadAPI()->getForkedFun(cs);
370
- }
371
- inline const Value* getForkedFun(const Instruction *inst)
372
- {
373
- return ThreadAPI::getThreadAPI()->getForkedFun(inst);
374
- }
375
- //@}
376
-
377
- /// Return sole argument of the thread routine
378
- //@{
379
- inline const Value* getActualParmAtForkSite(const CallSite cs)
380
- {
381
- return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs);
382
- }
383
- inline const Value* getActualParmAtForkSite(const Instruction *inst)
384
- {
385
- return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(inst);
386
- }
387
- //@}
388
-
389
- /// Return the task function of the parallel_for routine
390
- //@{
391
- inline const Value* getTaskFuncAtHareParForSite(const CallSite cs)
392
- {
393
- return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(cs);
394
- }
395
- inline const Value* getTaskFuncAtHareParForSite(const Instruction *inst)
396
- {
397
- return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(inst);
398
- }
399
- //@}
400
-
401
- /// Return the task data argument of the parallel_for rountine
402
- //@{
403
- inline const Value* getTaskDataAtHareParForSite(const CallSite cs)
404
- {
405
- return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(cs);
406
- }
407
- inline const Value* getTaskDataAtHareParForSite(const Instruction *inst)
408
- {
409
- return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(inst);
410
- }
411
- //@}
412
-
413
104
  /// Return true if this value refers to a object
414
105
  bool isObject (const Value * ref);
415
106
 
416
- /// Return true if the value refers to constant data, e.g., i32 0
417
- inline bool isConstantData(const Value* val)
418
- {
419
- return SVFUtil::isa<ConstantData>(val)
420
- || SVFUtil::isa<ConstantAggregate>(val)
421
- || SVFUtil::isa<MetadataAsValue>(val)
422
- || SVFUtil::isa<BlockAddress>(val);
423
- }
424
-
425
107
  /// Method for dead function, which does not have any possible caller
426
108
  /// function address is not taken and never be used in call or invoke instruction
427
109
  //@{
@@ -436,43 +118,6 @@ inline bool ArgInDeadFunction (const Value * val)
436
118
  }
437
119
  //@}
438
120
 
439
- /// Program entry function e.g. main
440
- //@{
441
- /// Return true if this is a program entry function (e.g. main)
442
- inline bool isProgEntryFunction (const SVFFunction * fun)
443
- {
444
- return fun && fun->getName() == "main";
445
- }
446
-
447
- inline bool isProgEntryFunction (const Function * fun)
448
- {
449
- return fun && fun->getName() == "main";
450
- }
451
-
452
- /// Get program entry function from module.
453
- inline const SVFFunction* getProgFunction(SVFModule* svfModule, const std::string& funName)
454
- {
455
- for (SVFModule::const_iterator it = svfModule->begin(), eit = svfModule->end(); it != eit; ++it)
456
- {
457
- const SVFFunction *fun = *it;
458
- if (fun->getName()==funName)
459
- return fun;
460
- }
461
- return nullptr;
462
- }
463
-
464
- /// Get program entry function from module.
465
- inline const SVFFunction* getProgEntryFunction(SVFModule* svfModule)
466
- {
467
- for (SVFModule::const_iterator it = svfModule->begin(), eit = svfModule->end(); it != eit; ++it)
468
- {
469
- const SVFFunction *fun = *it;
470
- if (isProgEntryFunction(fun))
471
- return (fun);
472
- }
473
- return nullptr;
474
- }
475
-
476
121
  /// Return true if this is an argument of a program entry function (e.g. main)
477
122
  inline bool ArgInProgEntryFunction (const Value * val)
478
123
  {
@@ -483,24 +128,6 @@ inline bool ArgInProgEntryFunction (const Value * val)
483
128
  bool isPtrInDeadFunction (const Value * value);
484
129
  //@}
485
130
 
486
- /// Return true if this is a program exit function call
487
- //@{
488
- inline bool isProgExitFunction (const SVFFunction * fun)
489
- {
490
- return fun && (fun->getName() == "exit" ||
491
- fun->getName() == "__assert_rtn" ||
492
- fun->getName() == "__assert_fail" );
493
- }
494
-
495
- inline bool isProgExitCall(const CallSite cs)
496
- {
497
- return isProgExitFunction(getCallee(cs));
498
- }
499
-
500
- inline bool isProgExitCall(const Instruction *inst)
501
- {
502
- return isProgExitFunction(getCallee(inst));
503
- }
504
131
  //@}
505
132
 
506
133
  /// Function does not have any possible caller in the call graph
@@ -677,7 +304,6 @@ u32_t getTypeSizeInBytes(const Type* type);
677
304
  u32_t getTypeSizeInBytes(const StructType *sty, u32_t field_index);
678
305
  //@}
679
306
 
680
- const std::string type2String(const Type* type);
681
307
 
682
308
  } // End namespace SVFUtil
683
309
 
@@ -94,7 +94,6 @@ typedef llvm::Argument Argument;
94
94
  typedef llvm::Constant Constant;
95
95
  typedef llvm::ConstantInt ConstantInt;
96
96
  typedef llvm::ConstantPointerNull ConstantPointerNull;
97
- typedef llvm::ConstantArray ConstantArray;
98
97
  typedef llvm::GlobalAlias GlobalAlias;
99
98
 
100
99
  /// LLVM metadata
@@ -352,6 +352,385 @@ bool startAnalysisLimitTimer(unsigned timeLimit);
352
352
  /// timer or not (return value of startLimitTimer).
353
353
  void stopAnalysisLimitTimer(bool limitTimerSet);
354
354
 
355
+ /// Return true if the call is an external call (external library in function summary table)
356
+ /// If the libary function is redefined in the application code (e.g., memcpy), it will return false and will not be treated as an external call.
357
+ //@{
358
+ inline bool isExtCall(const SVFFunction* fun)
359
+ {
360
+ return fun && ExtAPI::getExtAPI()->is_ext(fun);
361
+ }
362
+
363
+ /// Return true if the call is a heap allocator/reallocator
364
+ //@{
365
+ /// note that these two functions are not suppose to be used externally
366
+ inline bool isHeapAllocExtFunViaRet(const SVFFunction* fun)
367
+ {
368
+ return fun && (ExtAPI::getExtAPI()->is_alloc(fun)
369
+ || ExtAPI::getExtAPI()->is_realloc(fun));
370
+ }
371
+
372
+ inline bool isHeapAllocExtFunViaArg(const SVFFunction* fun)
373
+ {
374
+ return fun && ExtAPI::getExtAPI()->is_arg_alloc(fun);
375
+ }
376
+
377
+ /// Get the position of argument that holds an allocated heap object.
378
+ //@{
379
+ inline int getHeapAllocHoldingArgPosition(const SVFFunction* fun)
380
+ {
381
+ return ExtAPI::getExtAPI()->get_alloc_arg_pos(fun);
382
+ }
383
+
384
+ /// Return true if the call is a heap reallocator
385
+ //@{
386
+ /// note that this function is not suppose to be used externally
387
+ inline bool isReallocExtFun(const SVFFunction* fun)
388
+ {
389
+ return fun && (ExtAPI::getExtAPI()->is_realloc(fun));
390
+ }
391
+
392
+ /// Return true if the call is a heap dealloc or not
393
+ //@{
394
+ /// note that this function is not suppose to be used externally
395
+ inline bool isDeallocExtFun(const SVFFunction* fun)
396
+ {
397
+ return fun && (ExtAPI::getExtAPI()->is_dealloc(fun));
398
+ }
399
+
400
+ /// Return true if the call is a static global call
401
+ //@{
402
+ /// note that this function is not suppose to be used externally
403
+ inline bool isStaticExtFun(const SVFFunction* fun)
404
+ {
405
+ return fun && ExtAPI::getExtAPI()->has_static(fun);
406
+ }
407
+
408
+ /// Return external call type
409
+ inline ExtAPI::extf_t extCallTy(const SVFFunction* fun)
410
+ {
411
+ return ExtAPI::getExtAPI()->get_type(fun);
412
+ }
413
+
414
+ /// Program entry function e.g. main
415
+ //@{
416
+ /// Return true if this is a program entry function (e.g. main)
417
+ inline bool isProgEntryFunction (const SVFFunction * fun)
418
+ {
419
+ return fun && fun->getName() == "main";
420
+ }
421
+
422
+
423
+ /// Get program entry function from module.
424
+ inline const SVFFunction* getProgFunction(SVFModule* svfModule, const std::string& funName)
425
+ {
426
+ for (SVFModule::const_iterator it = svfModule->begin(), eit = svfModule->end(); it != eit; ++it)
427
+ {
428
+ const SVFFunction *fun = *it;
429
+ if (fun->getName()==funName)
430
+ return fun;
431
+ }
432
+ return nullptr;
433
+ }
434
+
435
+ /// Get program entry function from module.
436
+ inline const SVFFunction* getProgEntryFunction(SVFModule* svfModule)
437
+ {
438
+ for (SVFModule::const_iterator it = svfModule->begin(), eit = svfModule->end(); it != eit; ++it)
439
+ {
440
+ const SVFFunction *fun = *it;
441
+ if (isProgEntryFunction(fun))
442
+ return (fun);
443
+ }
444
+ return nullptr;
445
+ }
446
+
447
+ /// Return true if this is a program exit function call
448
+ //@{
449
+ inline bool isProgExitFunction (const SVFFunction * fun)
450
+ {
451
+ return fun && (fun->getName() == "exit" ||
452
+ fun->getName() == "__assert_rtn" ||
453
+ fun->getName() == "__assert_fail" );
454
+ }
455
+
456
+ /// Return true if the value refers to constant data, e.g., i32 0
457
+ inline bool isConstantData(const Value* val)
458
+ {
459
+ return SVFUtil::isa<ConstantData>(val)
460
+ || SVFUtil::isa<ConstantAggregate>(val)
461
+ || SVFUtil::isa<MetadataAsValue>(val)
462
+ || SVFUtil::isa<BlockAddress>(val);
463
+ }
464
+
465
+ /// Return thread fork function
466
+ //@{
467
+ inline const Value* getForkedFun(const CallSite cs)
468
+ {
469
+ return ThreadAPI::getThreadAPI()->getForkedFun(cs);
470
+ }
471
+ inline const Value* getForkedFun(const Instruction *inst)
472
+ {
473
+ return ThreadAPI::getThreadAPI()->getForkedFun(inst);
474
+ }
475
+ //@}
476
+
477
+ const std::string type2String(const Type* type);
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
+
355
734
  } // End namespace SVFUtil
356
735
 
357
736
  } // End namespace SVF
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1037",
3
+ "version": "1.0.1040",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {