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

Create callgraph #1580

Merged
merged 10 commits into from
Nov 5, 2024
Merged

Conversation

Geoffrey1014
Copy link
Contributor

add callgraph class

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 63.41463% with 45 lines in your changes missing coverage. Please review.

Project coverage is 62.94%. Comparing base (2108688) to head (1bcb6b6).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
svf/lib/Graphs/CallGraph.cpp 43.54% 35 Missing ⚠️
svf/lib/Util/CallGraphBuilder.cpp 50.00% 3 Missing ⚠️
svf/lib/Util/SVFUtil.cpp 50.00% 2 Missing ⚠️
svf/include/Graphs/CallGraph.h 94.73% 1 Missing ⚠️
svf/lib/MSSA/MemSSA.cpp 0.00% 1 Missing ⚠️
svf/lib/MemoryModel/PointerAnalysis.cpp 0.00% 1 Missing ⚠️
svf/lib/Util/CDGBuilder.cpp 0.00% 1 Missing ⚠️
svf/lib/Util/ThreadAPI.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1580      +/-   ##
==========================================
- Coverage   63.00%   62.94%   -0.07%     
==========================================
  Files         244      246       +2     
  Lines       27274    27342      +68     
  Branches     4519     4520       +1     
==========================================
+ Hits        17185    17211      +26     
- Misses      10089    10131      +42     
Files with missing lines Coverage Δ
svf-llvm/include/SVF-LLVM/LLVMModule.h 94.59% <ø> (ø)
svf/include/Graphs/PTACallGraph.h 93.22% <100.00%> (+1.55%) ⬆️
svf/include/Graphs/ThreadCallGraph.h 50.84% <ø> (ø)
svf/include/SVFIR/SVFIR.h 100.00% <100.00%> (ø)
svf/lib/Graphs/PTACallGraph.cpp 71.85% <100.00%> (-5.49%) ⬇️
svf/lib/Graphs/ThreadCallGraph.cpp 66.66% <100.00%> (ø)
svf/lib/MSSA/MemRegion.cpp 70.45% <100.00%> (ø)
svf/lib/MSSA/SVFGBuilder.cpp 86.11% <100.00%> (ø)
svf/lib/MTA/TCT.cpp 71.56% <100.00%> (ø)
svf/lib/SABER/SaberCondAllocator.cpp 87.80% <100.00%> (ø)
... and 10 more

typedef Set<const CallICFGNode*> CallInstSet;
enum CEDGEK
{
CallRetEdge,TDForkEdge,TDJoinEdge,HareParForEdge
Copy link
Contributor

Choose a reason for hiding this comment

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

Only callretedge

{
return csId;
}
inline CallInstSet& getDirectCalls()
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed.


/// Add direct callsite
//@{
void addDirectCallSite(const CallICFGNode* call);
Copy link
Contributor

Choose a reason for hiding this comment

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

can be made protected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

callgraphedge's addDirectCallSite is used in CallGraph, so it cannot be protected

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it is only used in 'CallGraph', it can be made as private.


/// Add/Get CallSiteID
//@{
inline CallSiteID addCallSite(const CallICFGNode* cs, const SVFFunction* callee)
Copy link
Contributor

@jumormt jumormt Oct 28, 2024

Choose a reason for hiding this comment

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

can be made protected

typedef GenericEdge<PTACallGraphNode> GenericCallGraphEdgeTy;
class PTACallGraphEdge : public GenericCallGraphEdgeTy
typedef GenericEdge<PTACallGraphNode> GenericPTACallGraphEdgeTy;
class PTACallGraphEdge : public GenericPTACallGraphEdgeTy
Copy link
Contributor

Choose a reason for hiding this comment

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

make necessary changes similar to CallGraphEdge

typedef GenericGraph<PTACallGraphNode, PTACallGraphEdge> GenericCallGraphTy;
class PTACallGraph : public GenericCallGraphTy
typedef GenericGraph<PTACallGraphNode, PTACallGraphEdge> GenericPTACallGraphTy;
class PTACallGraph : public GenericPTACallGraphTy
Copy link
Contributor

Choose a reason for hiding this comment

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

make necessary changes similar to CallGraph


private:
/// Call site information
static CallSiteToIdMap csToIdMap; ///< Map a pair of call instruction and callee to a callsite ID
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need csToIdMap, idToCSMap and totalCallSiteNum in CallGraph?

@Geoffrey1014
Copy link
Contributor Author

--- master.txt 2024-11-05 15:14:46
+++ callgraph.txt 2024-11-05 15:14:47
@@ -30,9 +30,9 @@
VarArrayObj 831
VarStructObj 1664
----------------Time and memory stats--------------------
-LLVMIRTime 4.101
-SVFIRTime 3.806
-SymbolTableTime 0.658
+LLVMIRTime 4.081
+SVFIRTime 2.555
+SymbolTableTime 0.517
#######################################################

PTACallGraph Stats (Andersen analysis)******
\ No newline at end of file
@@ -59,11 +59,11 @@
CollapseTime 0
CopyGepTime 0
LoadStoreTime 0
-MemoryUsageVmrss 4.16458e+06
-MemoryUsageVmsize 4.16454e+06
+MemoryUsageVmrss 4.16461e+06
+MemoryUsageVmsize 4.16455e+06
SCCDetectTime 0
SCCMergeTime 0
-TotalTime 121.433
+TotalTime 116.863
UpdateCGTime 0
----------------Numbers stats----------------------------
AddrProcessed 17887
\ No newline at end of file
@@ -114,47 +114,47 @@
Persistent Points-To Cache Statistics: Andersen's analysis bitvector
################ (program : redis-server.bc)###############
UniquePointsToSets 44837
-TotalUnions 673052
+TotalUnions 673053
PropertyUnions 222658
UniqueUnions 19260
LookupUnions 395148
-PreemptiveUnions 35986
+PreemptiveUnions 35987
TotalComplements 3364152
PropertyComplements 2998574
UniqueComplements 16887
LookupComplements 331806
PreemptiveComplements 16885
-TotalIntersections 4182803
-PropertyIntersections 4145525
+TotalIntersections 4182804
+PropertyIntersections 4145533
UniqueIntersections 842
-LookupIntersections 2147
-PreemptiveIntersections 34289
+LookupIntersections 2139
+PreemptiveIntersections 34290
#######################################################

Memory SSA Statistics******
################ (program : redis-server.bc)###############
----------------Time and memory stats--------------------
-AverageRegSize 85.0301
-GenMUCHITime 1.86
-GenRegionTime 485.119
-InsertPHITime 0.571
-SSARenameTime 0.127
-TotalMSSATime 487.692
+AverageRegSize 85.727
+GenMUCHITime 1.791
+GenRegionTime 501.038
+InsertPHITime 0.503
+SSARenameTime 0.092
+TotalMSSATime 503.432
----------------Numbers stats----------------------------
BBHasMSSAPhi 10755
-CSChiNode 112337
+CSChiNode 111246
CSHasChi 22679
CSHasMu 24549
-CSMuNode 164766
-FunEntryChi 24535
+CSMuNode 163193
+FunEntryChi 24294
FunHasEntryChi 3967
FunHasRetMu 4630
-FunRetMu 24466
+FunRetMu 24225
LoadHasMu 24342
LoadMuNode 43202
-MSSAPhi 60232
+MSSAPhi 59315
MaxRegSize 1650
-MemRegions 4580
+MemRegions 4538
StoreChiNode 14269
StoreHasChi 10507
#######################################################
\ No newline at end of file
@@ -162,16 +162,16 @@
SVFG Statistics******
################ (program : redis-server.bc)###############
----------------Time and memory stats--------------------
-ATNodeTime 0.915
-AvgWeight 166.005
+ATNodeTime 0.912
+AvgWeight 167.789
ConnDirEdgeTime 0
-ConnIndEdgeTime 4.553
+ConnIndEdgeTime 4.525
OptTime 0
TLNodeTime 0
-TotalTime 5.468
+TotalTime 5.437
----------------Numbers stats----------------------------
-ActualIn 164766
-ActualOut 112337
+ActualIn 163193
+ActualOut 111246
ActualParam 57426
ActualRet 7530
Addr 17887
\ No newline at end of file
@@ -183,25 +183,25 @@
DirectCallEdge 41434
DirectEdge 292884
DirectRetEdge 7351
-FormalIn 24535
-FormalOut 24466
+FormalIn 24294
+FormalOut 24225
FormalParam 7869
FormalRet 795
Gep 84876
-IndCallEdge 192075
-IndRetEdge 126074
-IndirectEdge 724691
-IndirectEdgeLabels 120302478
+IndCallEdge 189998
+IndRetEdge 124671
+IndirectEdge 717043
+IndirectEdgeLabels 120311897
Load 24342
-MSSAPhi 60232
+MSSAPhi 59315
MaxInDegree 9710
MaxIndInDeg 9710
MaxIndOutDeg 2458
MaxOutDegree 9600
PHI 6776
Store 24164
-TotalEdge 1017575
-TotalNode 632140
+TotalEdge 1009927
+TotalNode 628077
#######################################################

PTACallGraph Stats (Flow-sensitive analysis)******
\ No newline at end of file
@@ -222,28 +222,28 @@
----------------Time and memory stats--------------------
AddrTime 0
AverageSCCSize 19.105
-AvgPtsSize 67.7966
+AvgPtsSize 67.7948
AvgTopLvlPtsSize 369.968
-AvgVersionPtsSize 32.3075
+AvgVersionPtsSize 32.3067
CopyTime 0
DirectPropaTime 0
GepTime 0
IndirectPropaTime 0
LoadTime 0
-MemoryUsageVmrss 3.57764e+06
-MemoryUsageVmsize 3.61505e+06
+MemoryUsageVmrss 3.57665e+06
+MemoryUsageVmsize 3.61197e+06
PhiTime 0
-PrelabelingTime 0.131
+PrelabelingTime 0.125
ProcessTime 0
PropagationTime 0
SCCTime 0
-SolveTime 422.656
+SolveTime 406.923
StoreTime 0
Strong/WeakUpdTime 0
-TotalTime 637.671
+TotalTime 621.122
UpdateCGTime 0
VersionPropTime 0
-meldLabelingTime 211.668
+meldLabelingTime 211.009
----------------Numbers stats----------------------------
CopysNum 14138
DummyFieldPtrs 2305
\ No newline at end of file
@@ -261,33 +261,33 @@
Pointers 494739
ProcessedAParam 0
ProcessedAddr 107322
-ProcessedCopy 162617
+ProcessedCopy 160966
ProcessedFRet 0
-ProcessedGep 867729
-ProcessedLoad 899817
-ProcessedMSSANode 2318016
-ProcessedPhi 104061
-ProcessedStore 325348
+ProcessedGep 862436
+ProcessedLoad 840146
+ProcessedMSSANode 2293638
+ProcessedPhi 102466
+ProcessedStore 314283
SolveIterations 6
StoresNum 24164
StrongUpdates 3378
TotalEmptyVPts 0
-TotalExistingVPts 15080114
-TotalNonEmptyVPts 15080114
+TotalExistingVPts 15080539
+TotalNonEmptyVPts 15080539
TotalObjects 15741
TotalPointers 497044
TotalSingleVObjs 0
-TotalVersions 17441804
+TotalVersions 17442525
#######################################################

Persistent Points-To Cache Statistics: flow-sensitive analysis bitvector
################ (program : redis-server.bc)###############
-UniquePointsToSets 29667
-TotalUnions 1169886217
-PropertyUnions 1012294655
-UniqueUnions 38241
-LookupUnions 157501857
-PreemptiveUnions 51464
+UniquePointsToSets 29529
+TotalUnions 1100930485
+PropertyUnions 955694200
+UniqueUnions 37377
+LookupUnions 145148532
+PreemptiveUnions 50376
TotalComplements 0
PropertyComplements 0
UniqueComplements 0
\ No newline at end of file

@yuleisui yuleisui merged commit 1b11c8c into SVF-tools:master Nov 5, 2024
5 checks passed
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.

3 participants