Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use extapi.bc to replace ExtAPI.json #1150

Closed
wants to merge 5 commits into from

Conversation

shuangxiangkan
Copy link
Contributor

No description provided.

CMakeLists.txt Outdated
# Compile extapi.c to extapi.bc
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/include/Util/extapi.bc
COMMAND ${PROJECT_SOURCE_DIR}/llvm-14.0.0.obj/bin/clang -S -c -Xclang -disable-O0-optnone -fno-discard-value-names -emit-llvm ${PROJECT_SOURCE_DIR}/svf/lib/Util/extapi.c -o ${PROJECT_BINARY_DIR}/include/Util/extapi.bc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can not use llvm-14.0.0 here. Need to use the version in build.sh

@@ -115,7 +115,7 @@ function build_llvm_from_source {
mkdir llvm-build
cd llvm-build
# /*/ is a dirty hack to get llvm-project-llvmorg-version...
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$SVFHOME/$LLVMHome" ../llvm-source/*/llvm
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$SVFHOME/$LLVMHome" -DLLVM_ENABLE_PROJECTS=clang ../llvm-source/*/llvm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the previous cmake command doesn't generate clang, it prevents the use of clang to compile extapi.bc later on.

/*
The functions in extapi.bc are named using two patterns:
1: "svf_methodName";
2: "svf_methodName_methodProperties";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure use the below format methodname_propety_orginalname

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some function names are substrings of other function names, such as "malloc" and "safe_malloc," there is an issue when matching app function names with extapi function names. This problem results in one app function name matching multiple extapi function names. To avoid this problem, placing the prefix "svf_" in front of the function names, such as "svf_malloc" and "svf_safe_malloc," can prevent this issue.

@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Merging #1150 (e7b4759) into master (3f20e97) will decrease coverage by 1.65%.
The diff coverage is 89.84%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1150      +/-   ##
==========================================
- Coverage   64.68%   63.03%   -1.65%     
==========================================
  Files         223      221       -2     
  Lines       23821    23328     -493     
==========================================
- Hits        15408    14705     -703     
- Misses       8413     8623     +210     
Impacted Files Coverage Δ
svf-llvm/include/SVF-LLVM/SVFIRBuilder.h 88.88% <ø> (ø)
svf/include/SVFIR/SVFModule.h 78.94% <ø> (ø)
svf/lib/SVFIR/SVFModule.cpp 100.00% <ø> (ø)
svf-llvm/lib/SymbolTableBuilder.cpp 84.83% <50.00%> (-2.35%) ⬇️
svf-llvm/lib/SVFIRExtAPI.cpp 80.57% <83.17%> (+0.25%) ⬆️
svf-llvm/lib/SVFIRBuilder.cpp 78.11% <88.88%> (+0.04%) ⬆️
svf-llvm/include/SVF-LLVM/LLVMUtil.h 78.88% <100.00%> (+5.55%) ⬆️
svf-llvm/lib/LLVMModule.cpp 83.11% <100.00%> (+2.76%) ⬆️
svf-llvm/lib/LLVMUtil.cpp 71.00% <100.00%> (+1.42%) ⬆️
svf/include/Util/SVFUtil.h 91.35% <100.00%> (-0.31%) ⬇️

... and 28 files with indirect coverage changes

@shuangxiangkan
Copy link
Contributor Author

SVF with ExtAPI.json:
Andersen Pointer Analysis Stats******
################ (program : mutt.bc)###############

TotalTime 62.016
CollapseTime 0
SCCDetectTime 0
SCCMergeTime 0
LoadStoreTime 0
CopyGepTime 0
UpdateCGTime 0
AvgPtsSetSize 61.9022
AvgTopLvlPtsSize 162.714
TotalPointers 184442
TotalObjects 7782
IndCallSites 965
AddrProcessed 9415
CopyProcessed 165688
GepProcessed 69164
LoadProcessed 7511605
StoreProcessed 1007016
NumOfSFRs 0
NumOfFieldExpand 0
Pointers 183696
MemObjects 5194
DummyFieldPtrs 746
FieldObjs 2588
MaxPtsSetSize 699
SolveIterations 13
IndEdgeSolved 3556
NumOfSCCDetect 13
TotalCycleNum 539
TotalPWCCycleNum 41
NodesInCycles 2250
MaxNodesInSCC 118
NullPointer 1358
PointsToConstPtr 9853
PointsToBlkPtr 0
#######################################################

SVF with extapi.bc:
Andersen Pointer Analysis Stats******
################ (program : mutt.bc)###############

TotalTime 42.219
CollapseTime 0
SCCDetectTime 0
SCCMergeTime 0
LoadStoreTime 0
CopyGepTime 0
UpdateCGTime 0
AvgPtsSetSize 53.0234
AvgTopLvlPtsSize 140.098
TotalPointers 184669
TotalObjects 6970
IndCallSites 965
AddrProcessed 9131
CopyProcessed 142332
GepProcessed 63256
LoadProcessed 2577543
StoreProcessed 352734
NumOfSFRs 0
NumOfFieldExpand 0
Pointers 183918
MemObjects 4910
DummyFieldPtrs 751
FieldObjs 2060
MaxPtsSetSize 1138
SolveIterations 11
IndEdgeSolved 4907
NumOfSCCDetect 11
TotalCycleNum 483
TotalPWCCycleNum 35
NodesInCycles 1882
MaxNodesInSCC 118
NullPointer 1184
PointsToConstPtr 10954
PointsToBlkPtr 0
#######################################################

@shuangxiangkan
Copy link
Contributor Author

SVF with extapi.bc:

Andersen Pointer Analysis Stats******
################ (program : evim.bc)###############

TotalTime 42.356
CollapseTime 0
SCCDetectTime 0
SCCMergeTime 0
LoadStoreTime 0
CopyGepTime 0
UpdateCGTime 0
AvgPtsSetSize 50.3465
AvgTopLvlPtsSize 145.144
TotalPointers 384032
TotalObjects 21255
IndCallSites 566
AddrProcessed 22726
CopyProcessed 213342
GepProcessed 92784
LoadProcessed 1331323
StoreProcessed 388963
NumOfSFRs 0
NumOfFieldExpand 0
Pointers 382731
MemObjects 17819
DummyFieldPtrs 1301
FieldObjs 3436
MaxPtsSetSize 426
SolveIterations 10
IndEdgeSolved 1739
NumOfSCCDetect 10
TotalCycleNum 342
TotalPWCCycleNum 106
NodesInCycles 4052
MaxNodesInSCC 1597
NullPointer 2313
PointsToConstPtr 15467
PointsToBlkPtr 0
#######################################################

SVF with ExtAPI.json:

Andersen Pointer Analysis Stats******
################ (program : evim.bc)###############

TotalTime 44.765
CollapseTime 0
SCCDetectTime 0
SCCMergeTime 0
LoadStoreTime 0
CopyGepTime 0
UpdateCGTime 0
AvgPtsSetSize 50.3631
AvgTopLvlPtsSize 145.342
TotalPointers 383856
TotalObjects 21525
IndCallSites 566
AddrProcessed 22726
CopyProcessed 210263
GepProcessed 92339
LoadProcessed 1382274
StoreProcessed 405518
NumOfSFRs 0
NumOfFieldExpand 0
Pointers 382555
MemObjects 18074
DummyFieldPtrs 1301
FieldObjs 3451
MaxPtsSetSize 433
SolveIterations 11
IndEdgeSolved 1739
NumOfSCCDetect 11
TotalCycleNum 347
TotalPWCCycleNum 106
NodesInCycles 4062
MaxNodesInSCC 1597
NullPointer 2315
PointsToConstPtr 15246
PointsToBlkPtr 0
#######################################################

SVF with extapi.bc:

Andersen Pointer Analysis Stats******
################ (program : vi.bc)###############

TotalTime 40.068
CollapseTime 0
SCCDetectTime 0
SCCMergeTime 0
LoadStoreTime 0
CopyGepTime 0
UpdateCGTime 0
AvgPtsSetSize 52.0716
AvgTopLvlPtsSize 154.493
TotalPointers 341083
TotalObjects 18074
IndCallSites 515
AddrProcessed 19883
CopyProcessed 197242
GepProcessed 85748
LoadProcessed 1264901
StoreProcessed 374892
NumOfSFRs 0
NumOfFieldExpand 0
Pointers 339949
MemObjects 15680
DummyFieldPtrs 1134
FieldObjs 2394
MaxPtsSetSize 423
SolveIterations 11
IndEdgeSolved 1721
NumOfSCCDetect 11
TotalCycleNum 327
TotalPWCCycleNum 101
NodesInCycles 3922
MaxNodesInSCC 1597
NullPointer 162
PointsToConstPtr 14486
PointsToBlkPtr 0
#######################################################

SVF with ExtAPI.json:

Andersen Pointer Analysis Stats******
################ (program : vi.bc)###############

TotalTime 37.474
CollapseTime 0
SCCDetectTime 0
SCCMergeTime 0
LoadStoreTime 0
CopyGepTime 0
UpdateCGTime 0
AvgPtsSetSize 51.9016
AvgTopLvlPtsSize 153.834
TotalPointers 341228
TotalObjects 17828
IndCallSites 515
AddrProcessed 19873
CopyProcessed 199949
GepProcessed 86199
LoadProcessed 1218658
StoreProcessed 359588
NumOfSFRs 0
NumOfFieldExpand 0
Pointers 340094
MemObjects 15444
DummyFieldPtrs 1134
FieldObjs 2384
MaxPtsSetSize 415
SolveIterations 10
IndEdgeSolved 1721
NumOfSCCDetect 10
TotalCycleNum 324
TotalPWCCycleNum 101
NodesInCycles 3913
MaxNodesInSCC 1597
NullPointer 161
PointsToConstPtr 14702
PointsToBlkPtr 0
#######################################################

SVF with extapi.bc:

Andersen Pointer Analysis Stats******
################ (program : bash.bc)###############

TotalTime 29.434
CollapseTime 0
SCCDetectTime 0
SCCMergeTime 0
LoadStoreTime 0
CopyGepTime 0
UpdateCGTime 0
AvgPtsSetSize 60.6112
AvgTopLvlPtsSize 176.922
TotalPointers 223550
TotalObjects 13972
IndCallSites 68
AddrProcessed 14874
CopyProcessed 123774
GepProcessed 38925
LoadProcessed 924289
StoreProcessed 300699
NumOfSFRs 0
NumOfFieldExpand 0
Pointers 222611
MemObjects 12713
DummyFieldPtrs 939
FieldObjs 1259
MaxPtsSetSize 323
SolveIterations 9
IndEdgeSolved 1349
NumOfSCCDetect 9
TotalCycleNum 212
TotalPWCCycleNum 25
NodesInCycles 2113
MaxNodesInSCC 263
NullPointer 576
PointsToConstPtr 12220
PointsToBlkPtr 0
#######################################################

SVF with ExtAPI.json:

Andersen Pointer Analysis Stats******
################ (program : bash.bc)###############

TotalTime 31.55
CollapseTime 0
SCCDetectTime 0
SCCMergeTime 0
LoadStoreTime 0
CopyGepTime 0
UpdateCGTime 0
AvgPtsSetSize 62.0863
AvgTopLvlPtsSize 180.973
TotalPointers 223360
TotalObjects 13954
IndCallSites 68
AddrProcessed 14853
CopyProcessed 120665
GepProcessed 36848
LoadProcessed 1107860
StoreProcessed 388316
NumOfSFRs 0
NumOfFieldExpand 0
Pointers 222421
MemObjects 12692
DummyFieldPtrs 939
FieldObjs 1262
MaxPtsSetSize 354
SolveIterations 9
IndEdgeSolved 1349
NumOfSCCDetect 9
TotalCycleNum 218
TotalPWCCycleNum 25
NodesInCycles 2153
MaxNodesInSCC 263
NullPointer 633
PointsToConstPtr 11601
PointsToBlkPtr 0
#######################################################

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants