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

Callgraph #1570

Merged
merged 23 commits into from
Oct 11, 2024
Merged

Callgraph #1570

merged 23 commits into from
Oct 11, 2024

Conversation

Geoffrey1014
Copy link
Contributor

add a copy constuctor for CallGraph class
bullding callgraphs in CallGraphBuilder
building threadCallGraphs in ThreadCallGraphBuilder
merge ThreadCallGraphBuilder into CallgraphBuilder
remove callgraph field in CallgraphBuilder

protected:
CallGraph* callgraph;
const SVFModule::FunctionSetType* svfFunctionSet;
Copy link
Contributor

Choose a reason for hiding this comment

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

typedef SVFModule::FunctionSetType FunctionSetType;


buildCallGraph(svfModule);

CallGraph* callgraph = new ThreadCallGraph(*(PAG::getPAG()->getCallGraph()));
ThreadCallGraph* cg = dyn_cast<ThreadCallGraph>(callgraph);
Copy link
Contributor

Choose a reason for hiding this comment

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

ThreadCallGraph* cg = new ThreadCallGraph(*(PAG::getPAG()->getCallGraph()));


buildCallGraph(svfModule);

CallGraph* callgraph = new ThreadCallGraph(*(PAG::getPAG()->getCallGraph()));
Copy link
Contributor

Choose a reason for hiding this comment

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

delete this line

ThreadCallGraph* cg = dyn_cast<ThreadCallGraph>(callgraph);
assert(cg && "not a thread callgraph?");

ThreadAPI* tdAPI = ThreadAPI::getThreadAPI();
for (SVFModule::const_iterator F = svfModule->begin(), E = svfModule->end(); F != E; ++F)
for (const auto& item: *PAG::getPAG()->getCallGraph())
Copy link
Contributor

Choose a reason for hiding this comment

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

use a tmp variable to store PAG::getPAG()->getCallGraph() at the beginning of the function

return callgraph;
}

CallGraph* ThreadCallGraphBuilder::buildThreadCallGraph(SVFModule* svfModule)
CallGraph* CallGraphBuilder::buildThreadCallGraph()
Copy link
Contributor

Choose a reason for hiding this comment

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

return Threadcallgraph*

@Geoffrey1014
Copy link
Contributor Author

--- master.txt 2024-10-11 14:19:54
+++ callgraph.txt 2024-10-11 14:19:29
@@ -31,9 +31,9 @@
VarArrayObj 831
VarStructObj 1664
----------------Time and memory stats--------------------
-LLVMIRTime 4.236
-SVFIRTime 3.074
-SymbolTableTime 0.805
+LLVMIRTime 4.189
+SVFIRTime 2.728
+SymbolTableTime 0.735
#######################################################

CallGraph Stats (Andersen analysis)******
@@ -60,11 +60,11 @@
CollapseTime 0
CopyGepTime 0
LoadStoreTime 0
-MemoryUsageVmrss 4.16465e+06
-MemoryUsageVmsize 4.16453e+06
+MemoryUsageVmrss 4.1647e+06
+MemoryUsageVmsize 4.16454e+06
SCCDetectTime 0
SCCMergeTime 0
-TotalTime 117.17
+TotalTime 118.017
UpdateCGTime 0
----------------Numbers stats----------------------------
AddrProcessed 17887
@@ -115,32 +115,32 @@
Persistent Points-To Cache Statistics: Andersen's analysis bitvector
################ (program : redis-server.bc)###############
UniquePointsToSets 44837
-TotalUnions 673061
+TotalUnions 673064
PropertyUnions 222658
UniqueUnions 19259
LookupUnions 395149
-PreemptiveUnions 35995
+PreemptiveUnions 35998
TotalComplements 3364152
PropertyComplements 2998574
UniqueComplements 16887
LookupComplements 331806
PreemptiveComplements 16885
-TotalIntersections 4182813
-PropertyIntersections 4145551
-UniqueIntersections 781
-LookupIntersections 2182
-PreemptiveIntersections 34299
+TotalIntersections 4182816
+PropertyIntersections 4145395
+UniqueIntersections 851
+LookupIntersections 2268
+PreemptiveIntersections 34302
#######################################################

Memory SSA Statistics******
################ (program : redis-server.bc)###############
----------------Time and memory stats--------------------
AverageRegSize 85.0301
-GenMUCHITime 1.757
-GenRegionTime 486.224
-InsertPHITime 0.536
-SSARenameTime 0.087
-TotalMSSATime 488.619
+GenMUCHITime 1.812
+GenRegionTime 491.501
+InsertPHITime 0.499
+SSARenameTime 0.073
+TotalMSSATime 493.903
----------------Numbers stats----------------------------
BBHasMSSAPhi 10755
CSChiNode 112337
@@ -163,13 +163,13 @@
SVFG Statistics******
################ (program : redis-server.bc)###############
----------------Time and memory stats--------------------
-ATNodeTime 0.913
+ATNodeTime 0.9
AvgWeight 166.005
ConnDirEdgeTime 0
-ConnIndEdgeTime 4.459
+ConnIndEdgeTime 4.519
OptTime 0
TLNodeTime 0
-TotalTime 5.372
+TotalTime 5.419
----------------Numbers stats----------------------------
ActualIn 164766
ActualOut 112337
@@ -231,20 +231,20 @@
GepTime 0
IndirectPropaTime 0
LoadTime 0
-MemoryUsageVmrss 3.57877e+06
-MemoryUsageVmsize 3.61642e+06
+MemoryUsageVmrss 3.57379e+06
+MemoryUsageVmsize 3.60824e+06
PhiTime 0
PrelabelingTime 0.126
ProcessTime 0
PropagationTime 0
SCCTime 0
-SolveTime 417.791
+SolveTime 407.89
StoreTime 0
Strong/WeakUpdTime 0
-TotalTime 631.681
+TotalTime 624.623
UpdateCGTime 0
VersionPropTime 0
-meldLabelingTime 210.702
+meldLabelingTime 213.566
----------------Numbers stats----------------------------
CopysNum 14138
DummyFieldPtrs 2305
@@ -262,13 +262,13 @@
Pointers 494739
ProcessedAParam 0
ProcessedAddr 107322
-ProcessedCopy 163319
+ProcessedCopy 159938
ProcessedFRet 0
-ProcessedGep 872516
-ProcessedLoad 890456
+ProcessedGep 856747
+ProcessedLoad 850306
ProcessedMSSANode 2318016
-ProcessedPhi 104464
-ProcessedStore 324952
+ProcessedPhi 101273
+ProcessedStore 315673
SolveIterations 6
StoresNum 24164
StrongUpdates 3378
@@ -283,12 +283,12 @@

Persistent Points-To Cache Statistics: flow-sensitive analysis bitvector
################ (program : redis-server.bc)###############
-UniquePointsToSets 29750
-TotalUnions 1154903314
-PropertyUnions 997608084
-UniqueUnions 38152
-LookupUnions 157205610
-PreemptiveUnions 51468
+UniquePointsToSets 29423
+TotalUnions 1113910190
+PropertyUnions 966825643
+UniqueUnions 37254
+LookupUnions 146997055
+PreemptiveUnions 50238
TotalComplements 0
PropertyComplements 0
UniqueComplements 0

public:
CallGraphBuilder(CallGraph* cg, ICFG* i): callgraph(cg),icfg(i)

CallGraphBuilder(const SVFModule::FunctionSetType* fs, ICFG* i): svfFunctionSet(fs),icfg(i)
Copy link
Contributor

Choose a reason for hiding this comment

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

use FunctionSetType

buildCallGraph(svfModule);

ThreadCallGraph* cg = dyn_cast<ThreadCallGraph>(callgraph);
ThreadCallGraph* cg = new ThreadCallGraph(*(PAG::getPAG()->getCallGraph()));
Copy link
Contributor

Choose a reason for hiding this comment

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

PAG::getPAG()->getCallGraph() -> svfirCallGraph

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 16 lines in your changes missing coverage. Please review.

Project coverage is 62.86%. Comparing base (f9929a7) to head (ff5b75d).
Report is 1 commits behind head on master.

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1570      +/-   ##
==========================================
+ Coverage   62.84%   62.86%   +0.01%     
==========================================
  Files         245      244       -1     
  Lines       25665    25694      +29     
  Branches     4505     4514       +9     
==========================================
+ Hits        16130    16152      +22     
- Misses       9535     9542       +7     
Files with missing lines Coverage Δ
svf-llvm/include/SVF-LLVM/LLVMModule.h 94.11% <ø> (ø)
svf-llvm/lib/LLVMModule.cpp 83.77% <100.00%> (+0.02%) ⬆️
svf-llvm/lib/SVFIRBuilder.cpp 83.99% <100.00%> (+0.03%) ⬆️
svf/include/Graphs/ThreadCallGraph.h 52.00% <ø> (ø)
svf/include/SVFIR/SVFIR.h 100.00% <100.00%> (ø)
svf/include/SVFIR/SVFModule.h 78.57% <ø> (ø)
svf/include/Util/SVFUtil.h 89.13% <ø> (-0.67%) ⬇️
svf/lib/Graphs/CallGraph.cpp 76.69% <100.00%> (+2.96%) ⬆️
svf/lib/Graphs/SVFG.cpp 75.57% <100.00%> (ø)
svf/lib/Graphs/ThreadCallGraph.cpp 67.74% <100.00%> (+0.52%) ⬆️
... and 13 more

@@ -172,7 +172,7 @@ class ThreadCallGraph: public CallGraph
typedef Map<const CallICFGNode*, ParForEdgeSet> CallInstToParForEdgesMap;

/// Constructor
ThreadCallGraph();
ThreadCallGraph(CallGraph& cg);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be ThreadCallGraph& ?

@yuleisui yuleisui merged commit 5db169c into SVF-tools:master Oct 11, 2024
3 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