svf-lib 1.0.1646 → 1.0.1648
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/svf/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/svf-llvm/extapi.bc +1268 -1207
- package/SVF-linux/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-linux/svf/include/Util/SVFUtil.h +0 -34
- package/SVF-linux/svf-llvm/include/SVF-LLVM/LLVMUtil.h +2 -2
- package/SVF-osx/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/BasicTypes.h +4 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMUtil.h +49 -0
- package/package.json +1 -1
|
Binary file
|
|
@@ -350,14 +350,6 @@ inline bool isReallocExtFun(const SVFFunction* fun)
|
|
|
350
350
|
return fun && (ExtAPI::getExtAPI()->is_realloc(fun));
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
/// Return true if the call is a static global call
|
|
354
|
-
//@{
|
|
355
|
-
/// note that this function is not suppose to be used externally
|
|
356
|
-
inline bool isStaticExtFun(const SVFFunction* fun)
|
|
357
|
-
{
|
|
358
|
-
return fun && ExtAPI::getExtAPI()->has_static(fun);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
353
|
/// Program entry function e.g. main
|
|
362
354
|
//@{
|
|
363
355
|
/// Return true if this is a program entry function (e.g. main)
|
|
@@ -494,32 +486,6 @@ inline bool isReallocExtCall(const SVFInstruction *inst)
|
|
|
494
486
|
}
|
|
495
487
|
//@}
|
|
496
488
|
|
|
497
|
-
inline bool isStaticExtCall(const CallSite cs)
|
|
498
|
-
{
|
|
499
|
-
bool isPtrTy = cs.getInstruction()->getType()->isPointerTy();
|
|
500
|
-
return isPtrTy && isStaticExtFun(getCallee(cs));
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
inline bool isStaticExtCall(const SVFInstruction *inst)
|
|
504
|
-
{
|
|
505
|
-
bool isPtrTy = inst->getType()->isPointerTy();
|
|
506
|
-
return isPtrTy && isStaticExtFun(getCallee(inst));
|
|
507
|
-
}
|
|
508
|
-
//@}
|
|
509
|
-
|
|
510
|
-
/// Return true if the call is a static global call
|
|
511
|
-
//@{
|
|
512
|
-
inline bool isHeapAllocOrStaticExtCall(const CallSite cs)
|
|
513
|
-
{
|
|
514
|
-
return isStaticExtCall(cs) || isHeapAllocExtCall(cs);
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
inline bool isHeapAllocOrStaticExtCall(const SVFInstruction *inst)
|
|
518
|
-
{
|
|
519
|
-
return isStaticExtCall(inst) || isHeapAllocExtCall(inst);
|
|
520
|
-
}
|
|
521
|
-
//@}
|
|
522
|
-
|
|
523
489
|
/// Return true if this is a thread creation call
|
|
524
490
|
///@{
|
|
525
491
|
inline bool isThreadForkCall(const CallSite cs)
|
|
@@ -141,10 +141,10 @@ inline const PointerType *getRefTypeOfHeapAllocOrStatic(const CallBase* cs)
|
|
|
141
141
|
if (const PointerType *argType = SVFUtil::dyn_cast<PointerType>(arg->getType()))
|
|
142
142
|
refType = SVFUtil::dyn_cast<PointerType>(getPtrElementType(argType));
|
|
143
143
|
}
|
|
144
|
-
// Case 2: heap
|
|
144
|
+
// Case 2: heap object held by return value.
|
|
145
145
|
else
|
|
146
146
|
{
|
|
147
|
-
assert(
|
|
147
|
+
assert(SVFUtil::isHeapAllocExtCallViaRet(svfcs)
|
|
148
148
|
&& "Must be heap alloc via ret, or static allocation site");
|
|
149
149
|
refType = SVFUtil::dyn_cast<PointerType>(cs->getType());
|
|
150
150
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -178,6 +178,10 @@ typedef llvm::BinaryOperator BinaryOperator;
|
|
|
178
178
|
typedef llvm::UnaryOperator UnaryOperator;
|
|
179
179
|
typedef llvm::UndefValue UndefValue;
|
|
180
180
|
|
|
181
|
+
// Related to Switch Case
|
|
182
|
+
typedef std::pair<const BasicBlock*, const ConstantInt*> SuccBBAndCondValPair;
|
|
183
|
+
typedef std::vector<SuccBBAndCondValPair> SuccBBAndCondValPairVec;
|
|
184
|
+
|
|
181
185
|
// LLVM Intrinsic Instructions
|
|
182
186
|
#if LLVM_VERSION_MAJOR >= 13
|
|
183
187
|
typedef llvm::IntrinsicInst IntrinsicInst;
|
|
@@ -519,6 +519,55 @@ std::string llvmToString(const T& val)
|
|
|
519
519
|
llvm::raw_string_ostream(str) << val;
|
|
520
520
|
return str;
|
|
521
521
|
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* See more: https://github.com/SVF-tools/SVF/pull/1191
|
|
525
|
+
*
|
|
526
|
+
* Given the code:
|
|
527
|
+
*
|
|
528
|
+
* switch (a) {
|
|
529
|
+
* case 0: printf("0\n"); break;
|
|
530
|
+
* case 1:
|
|
531
|
+
* case 2:
|
|
532
|
+
* case 3: printf("a >=1 && a <= 3\n"); break;
|
|
533
|
+
* case 4:
|
|
534
|
+
* case 6:
|
|
535
|
+
* case 7: printf("a >= 4 && a <=7\n"); break;
|
|
536
|
+
* default: printf("a < 0 || a > 7"); break;
|
|
537
|
+
* }
|
|
538
|
+
*
|
|
539
|
+
* Generate the IR:
|
|
540
|
+
*
|
|
541
|
+
* switch i32 %0, label %sw.default [
|
|
542
|
+
* i32 0, label %sw.bb
|
|
543
|
+
* i32 1, label %sw.bb1
|
|
544
|
+
* i32 2, label %sw.bb1
|
|
545
|
+
* i32 3, label %sw.bb1
|
|
546
|
+
* i32 4, label %sw.bb3
|
|
547
|
+
* i32 6, label %sw.bb3
|
|
548
|
+
* i32 7, label %sw.bb3
|
|
549
|
+
* ]
|
|
550
|
+
*
|
|
551
|
+
* We can get every case basic block and related case value:
|
|
552
|
+
* [
|
|
553
|
+
* {%sw.default, -1},
|
|
554
|
+
* {%sw.bb, 0},
|
|
555
|
+
* {%sw.bb1, 1},
|
|
556
|
+
* {%sw.bb1, 2},
|
|
557
|
+
* {%sw.bb1, 3},
|
|
558
|
+
* {%sw.bb3, 4},
|
|
559
|
+
* {%sw.bb3, 6},
|
|
560
|
+
* {%sw.bb3, 7},
|
|
561
|
+
* ]
|
|
562
|
+
* Note: default case value is nullptr
|
|
563
|
+
*/
|
|
564
|
+
void getSuccBBandCondValPairVec(const SwitchInst &switchInst, SuccBBAndCondValPairVec &vec);
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Note: default case value is nullptr
|
|
568
|
+
*/
|
|
569
|
+
s64_t getCaseValue(const SwitchInst &switchInst, SuccBBAndCondValPair &succBB2CondVal);
|
|
570
|
+
|
|
522
571
|
} // End namespace LLVMUtil
|
|
523
572
|
|
|
524
573
|
} // End namespace SVF
|