[llvm-branch-commits] [BOLT][NFC] Refactoring CallGraph (PR #96922)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 27 09:18:31 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: shaw young (shawbyoung)

<details>
<summary>Changes</summary>

Moved CallGraph and BinaryFunctionCallGraph from Passes to
Core for future use in stale matching.


---
Full diff: https://github.com/llvm/llvm-project/pull/96922.diff


18 Files Affected:

- (renamed) bolt/include/bolt/Core/BinaryFunctionCallGraph.h (+1-1) 
- (renamed) bolt/include/bolt/Core/CallGraph.h () 
- (renamed) bolt/include/bolt/Core/CallGraphWalker.h () 
- (modified) bolt/include/bolt/Passes/HFSort.h (+1-1) 
- (modified) bolt/include/bolt/Passes/RegReAssign.h (+1-1) 
- (modified) bolt/include/bolt/Passes/ReorderFunctions.h (+1-1) 
- (renamed) bolt/lib/Core/BinaryFunctionCallGraph.cpp (+1-1) 
- (modified) bolt/lib/Core/CMakeLists.txt (+3) 
- (renamed) bolt/lib/Core/CallGraph.cpp (+1-1) 
- (renamed) bolt/lib/Core/CallGraphWalker.cpp (+2-2) 
- (modified) bolt/lib/Passes/CMakeLists.txt (-3) 
- (modified) bolt/lib/Passes/FrameAnalysis.cpp (+1-1) 
- (modified) bolt/lib/Passes/FrameOptimizer.cpp (+1-1) 
- (modified) bolt/lib/Passes/IndirectCallPromotion.cpp (+1-1) 
- (modified) bolt/lib/Passes/JTFootprintReduction.cpp (+1-1) 
- (modified) bolt/lib/Passes/RegAnalysis.cpp (+1-1) 
- (modified) bolt/lib/Passes/RegReAssign.cpp (+1-1) 
- (modified) bolt/lib/Passes/StokeInfo.cpp (+1-1) 


``````````diff
diff --git a/bolt/include/bolt/Passes/BinaryFunctionCallGraph.h b/bolt/include/bolt/Core/BinaryFunctionCallGraph.h
similarity index 98%
rename from bolt/include/bolt/Passes/BinaryFunctionCallGraph.h
rename to bolt/include/bolt/Core/BinaryFunctionCallGraph.h
index 52e17db4f50ce..4579c33985254 100644
--- a/bolt/include/bolt/Passes/BinaryFunctionCallGraph.h
+++ b/bolt/include/bolt/Core/BinaryFunctionCallGraph.h
@@ -9,7 +9,7 @@
 #ifndef BOLT_PASSES_BINARY_FUNCTION_CALLGRAPH_H
 #define BOLT_PASSES_BINARY_FUNCTION_CALLGRAPH_H
 
-#include "bolt/Passes/CallGraph.h"
+#include "bolt/Core/CallGraph.h"
 #include <deque>
 #include <functional>
 #include <unordered_map>
diff --git a/bolt/include/bolt/Passes/CallGraph.h b/bolt/include/bolt/Core/CallGraph.h
similarity index 100%
rename from bolt/include/bolt/Passes/CallGraph.h
rename to bolt/include/bolt/Core/CallGraph.h
diff --git a/bolt/include/bolt/Passes/CallGraphWalker.h b/bolt/include/bolt/Core/CallGraphWalker.h
similarity index 100%
rename from bolt/include/bolt/Passes/CallGraphWalker.h
rename to bolt/include/bolt/Core/CallGraphWalker.h
diff --git a/bolt/include/bolt/Passes/HFSort.h b/bolt/include/bolt/Passes/HFSort.h
index 3787187733d07..2a35760329bb8 100644
--- a/bolt/include/bolt/Passes/HFSort.h
+++ b/bolt/include/bolt/Passes/HFSort.h
@@ -19,7 +19,7 @@
 #ifndef BOLT_PASSES_HFSORT_H
 #define BOLT_PASSES_HFSORT_H
 
-#include "bolt/Passes/CallGraph.h"
+#include "bolt/Core/CallGraph.h"
 
 #include <string>
 #include <vector>
diff --git a/bolt/include/bolt/Passes/RegReAssign.h b/bolt/include/bolt/Passes/RegReAssign.h
index c50e32ff46e29..a7554a1215104 100644
--- a/bolt/include/bolt/Passes/RegReAssign.h
+++ b/bolt/include/bolt/Passes/RegReAssign.h
@@ -9,7 +9,7 @@
 #ifndef BOLT_PASSES_REGREASSIGN_H
 #define BOLT_PASSES_REGREASSIGN_H
 
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "bolt/Passes/BinaryPasses.h"
 #include "bolt/Passes/RegAnalysis.h"
 
diff --git a/bolt/include/bolt/Passes/ReorderFunctions.h b/bolt/include/bolt/Passes/ReorderFunctions.h
index 4c88142c58871..7da32324bc933 100644
--- a/bolt/include/bolt/Passes/ReorderFunctions.h
+++ b/bolt/include/bolt/Passes/ReorderFunctions.h
@@ -9,7 +9,7 @@
 #ifndef BOLT_PASSES_REORDER_FUNCTIONS_H
 #define BOLT_PASSES_REORDER_FUNCTIONS_H
 
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "bolt/Passes/BinaryPasses.h"
 
 namespace llvm {
diff --git a/bolt/lib/Passes/BinaryFunctionCallGraph.cpp b/bolt/lib/Core/BinaryFunctionCallGraph.cpp
similarity index 99%
rename from bolt/lib/Passes/BinaryFunctionCallGraph.cpp
rename to bolt/lib/Core/BinaryFunctionCallGraph.cpp
index bbcc9751c0cbe..86a31188c854a 100644
--- a/bolt/lib/Passes/BinaryFunctionCallGraph.cpp
+++ b/bolt/lib/Core/BinaryFunctionCallGraph.cpp
@@ -10,7 +10,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "bolt/Core/BinaryContext.h"
 #include "bolt/Core/BinaryFunction.h"
 #include "llvm/Support/CommandLine.h"
diff --git a/bolt/lib/Core/CMakeLists.txt b/bolt/lib/Core/CMakeLists.txt
index 873cf67a56291..bb58667066fd8 100644
--- a/bolt/lib/Core/CMakeLists.txt
+++ b/bolt/lib/Core/CMakeLists.txt
@@ -17,8 +17,11 @@ add_llvm_library(LLVMBOLTCore
   BinaryData.cpp
   BinaryEmitter.cpp
   BinaryFunction.cpp
+  BinaryFunctionCallGraph.cpp
   BinaryFunctionProfile.cpp
   BinarySection.cpp
+  CallGraph.cpp
+  CallGraphWalker.cpp
   DebugData.cpp
   DebugNames.cpp
   DIEBuilder.cpp
diff --git a/bolt/lib/Passes/CallGraph.cpp b/bolt/lib/Core/CallGraph.cpp
similarity index 99%
rename from bolt/lib/Passes/CallGraph.cpp
rename to bolt/lib/Core/CallGraph.cpp
index ee2ec26f3e50d..a7ea64fbbcf58 100644
--- a/bolt/lib/Passes/CallGraph.cpp
+++ b/bolt/lib/Core/CallGraph.cpp
@@ -10,7 +10,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "bolt/Passes/CallGraph.h"
+#include "bolt/Core/CallGraph.h"
 
 #define DEBUG_TYPE "callgraph"
 
diff --git a/bolt/lib/Passes/CallGraphWalker.cpp b/bolt/lib/Core/CallGraphWalker.cpp
similarity index 95%
rename from bolt/lib/Passes/CallGraphWalker.cpp
rename to bolt/lib/Core/CallGraphWalker.cpp
index 53fb1cb4d98c9..9d0087f79d17f 100644
--- a/bolt/lib/Passes/CallGraphWalker.cpp
+++ b/bolt/lib/Core/CallGraphWalker.cpp
@@ -10,8 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "bolt/Passes/CallGraphWalker.h"
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/CallGraphWalker.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Timer.h"
 #include <queue>
diff --git a/bolt/lib/Passes/CMakeLists.txt b/bolt/lib/Passes/CMakeLists.txt
index 04057a895d666..407d8b03f7397 100644
--- a/bolt/lib/Passes/CMakeLists.txt
+++ b/bolt/lib/Passes/CMakeLists.txt
@@ -4,11 +4,8 @@ add_llvm_library(LLVMBOLTPasses
   AllocCombiner.cpp
   AsmDump.cpp
   BinaryPasses.cpp
-  BinaryFunctionCallGraph.cpp
   CMOVConversion.cpp
   CacheMetrics.cpp
-  CallGraph.cpp
-  CallGraphWalker.cpp
   DataflowAnalysis.cpp
   DataflowInfoManager.cpp
   FrameAnalysis.cpp
diff --git a/bolt/lib/Passes/FrameAnalysis.cpp b/bolt/lib/Passes/FrameAnalysis.cpp
index 4ebfd8f158f7f..e624e68663ed0 100644
--- a/bolt/lib/Passes/FrameAnalysis.cpp
+++ b/bolt/lib/Passes/FrameAnalysis.cpp
@@ -12,7 +12,7 @@
 
 #include "bolt/Passes/FrameAnalysis.h"
 #include "bolt/Core/ParallelUtilities.h"
-#include "bolt/Passes/CallGraphWalker.h"
+#include "bolt/Core/CallGraphWalker.h"
 #include "llvm/MC/MCRegisterInfo.h"
 #include "llvm/Support/Timer.h"
 #include <fstream>
diff --git a/bolt/lib/Passes/FrameOptimizer.cpp b/bolt/lib/Passes/FrameOptimizer.cpp
index 8461225e1819c..3395321f579f7 100644
--- a/bolt/lib/Passes/FrameOptimizer.cpp
+++ b/bolt/lib/Passes/FrameOptimizer.cpp
@@ -12,7 +12,7 @@
 
 #include "bolt/Passes/FrameOptimizer.h"
 #include "bolt/Core/ParallelUtilities.h"
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "bolt/Passes/DataflowInfoManager.h"
 #include "bolt/Passes/ShrinkWrapping.h"
 #include "bolt/Passes/StackAvailableExpressions.h"
diff --git a/bolt/lib/Passes/IndirectCallPromotion.cpp b/bolt/lib/Passes/IndirectCallPromotion.cpp
index 55eede641fd2f..a73eb867b3777 100644
--- a/bolt/lib/Passes/IndirectCallPromotion.cpp
+++ b/bolt/lib/Passes/IndirectCallPromotion.cpp
@@ -11,7 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "bolt/Passes/IndirectCallPromotion.h"
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "bolt/Passes/DataflowInfoManager.h"
 #include "bolt/Passes/Inliner.h"
 #include "llvm/ADT/STLExtras.h"
diff --git a/bolt/lib/Passes/JTFootprintReduction.cpp b/bolt/lib/Passes/JTFootprintReduction.cpp
index fd291f96004d9..71bdbba950df1 100644
--- a/bolt/lib/Passes/JTFootprintReduction.cpp
+++ b/bolt/lib/Passes/JTFootprintReduction.cpp
@@ -11,7 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "bolt/Passes/JTFootprintReduction.h"
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "bolt/Passes/DataflowInfoManager.h"
 #include "llvm/Support/CommandLine.h"
 
diff --git a/bolt/lib/Passes/RegAnalysis.cpp b/bolt/lib/Passes/RegAnalysis.cpp
index 9054385c20b59..66ca6800b1a5f 100644
--- a/bolt/lib/Passes/RegAnalysis.cpp
+++ b/bolt/lib/Passes/RegAnalysis.cpp
@@ -12,7 +12,7 @@
 
 #include "bolt/Passes/RegAnalysis.h"
 #include "bolt/Core/BinaryFunction.h"
-#include "bolt/Passes/CallGraphWalker.h"
+#include "bolt/Core/CallGraphWalker.h"
 #include "llvm/MC/MCRegisterInfo.h"
 #include "llvm/Support/CommandLine.h"
 
diff --git a/bolt/lib/Passes/RegReAssign.cpp b/bolt/lib/Passes/RegReAssign.cpp
index 0becfb4a06a38..7478803cab7ce 100644
--- a/bolt/lib/Passes/RegReAssign.cpp
+++ b/bolt/lib/Passes/RegReAssign.cpp
@@ -12,7 +12,7 @@
 
 #include "bolt/Passes/RegReAssign.h"
 #include "bolt/Core/MCPlus.h"
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "bolt/Passes/DataflowAnalysis.h"
 #include "bolt/Passes/DataflowInfoManager.h"
 #include "bolt/Utils/Utils.h"
diff --git a/bolt/lib/Passes/StokeInfo.cpp b/bolt/lib/Passes/StokeInfo.cpp
index 499cac4217099..dd033508d200c 100644
--- a/bolt/lib/Passes/StokeInfo.cpp
+++ b/bolt/lib/Passes/StokeInfo.cpp
@@ -11,7 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "bolt/Passes/StokeInfo.h"
-#include "bolt/Passes/BinaryFunctionCallGraph.h"
+#include "bolt/Core/BinaryFunctionCallGraph.h"
 #include "bolt/Passes/DataflowInfoManager.h"
 #include "llvm/Support/CommandLine.h"
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/96922


More information about the llvm-branch-commits mailing list