Skip to content

Commit 2430a35

Browse files
authored
[BOLT][NFC] Move CallGraph from Passes to Core (#96922)
Moved CallGraph and BinaryFunctionCallGraph from Passes to Core for future use in stale matching.
1 parent 8044158 commit 2430a35

18 files changed

+31
-31
lines changed

bolt/include/bolt/Passes/BinaryFunctionCallGraph.h renamed to bolt/include/bolt/Core/BinaryFunctionCallGraph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- bolt/Passes/CallGraph.h ----------------------------------*- C++ -*-===//
1+
//===- bolt/Core/CallGraph.h ----------------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -9,7 +9,7 @@
99
#ifndef BOLT_PASSES_BINARY_FUNCTION_CALLGRAPH_H
1010
#define BOLT_PASSES_BINARY_FUNCTION_CALLGRAPH_H
1111

12-
#include "bolt/Passes/CallGraph.h"
12+
#include "bolt/Core/CallGraph.h"
1313
#include <deque>
1414
#include <functional>
1515
#include <unordered_map>

bolt/include/bolt/Passes/CallGraph.h renamed to bolt/include/bolt/Core/CallGraph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- bolt/Passes/CallGraph.h ----------------------------------*- C++ -*-===//
1+
//===- bolt/Core/CallGraph.h ----------------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

bolt/include/bolt/Passes/CallGraphWalker.h renamed to bolt/include/bolt/Core/CallGraphWalker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- bolt/Passes/CallGraphWalker.h ----------------------------*- C++ -*-===//
1+
//===- bolt/Core/CallGraphWalker.h ----------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

bolt/include/bolt/Passes/HFSort.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef BOLT_PASSES_HFSORT_H
2020
#define BOLT_PASSES_HFSORT_H
2121

22-
#include "bolt/Passes/CallGraph.h"
22+
#include "bolt/Core/CallGraph.h"
2323

2424
#include <string>
2525
#include <vector>

bolt/include/bolt/Passes/RegReAssign.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef BOLT_PASSES_REGREASSIGN_H
1010
#define BOLT_PASSES_REGREASSIGN_H
1111

12-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
12+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1313
#include "bolt/Passes/BinaryPasses.h"
1414
#include "bolt/Passes/RegAnalysis.h"
1515

bolt/include/bolt/Passes/ReorderFunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef BOLT_PASSES_REORDER_FUNCTIONS_H
1010
#define BOLT_PASSES_REORDER_FUNCTIONS_H
1111

12-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
12+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1313
#include "bolt/Passes/BinaryPasses.h"
1414

1515
namespace llvm {

bolt/lib/Passes/BinaryFunctionCallGraph.cpp renamed to bolt/lib/Core/BinaryFunctionCallGraph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- bolt/Passes/BinaryFunctionCallGraph.cpp ----------------------------===//
1+
//===- bolt/Core/BinaryFunctionCallGraph.cpp ----------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
13+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1414
#include "bolt/Core/BinaryContext.h"
1515
#include "bolt/Core/BinaryFunction.h"
1616
#include "llvm/Support/CommandLine.h"

bolt/lib/Core/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ add_llvm_library(LLVMBOLTCore
1717
BinaryData.cpp
1818
BinaryEmitter.cpp
1919
BinaryFunction.cpp
20+
BinaryFunctionCallGraph.cpp
2021
BinaryFunctionProfile.cpp
2122
BinarySection.cpp
23+
CallGraph.cpp
24+
CallGraphWalker.cpp
2225
DebugData.cpp
2326
DebugNames.cpp
2427
DIEBuilder.cpp

bolt/lib/Passes/CallGraph.cpp renamed to bolt/lib/Core/CallGraph.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- bolt/Passes/CallGraph.cpp ------------------------------------------===//
1+
//===- bolt/Core/CallGraph.cpp ------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,16 +10,16 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "bolt/Passes/CallGraph.h"
13+
#include "bolt/Core/CallGraph.h"
1414

1515
#define DEBUG_TYPE "callgraph"
1616

1717
#if defined(__x86_64__) && !defined(_MSC_VER)
18-
# if (!defined USE_SSECRC)
19-
# define USE_SSECRC
20-
# endif
18+
#if (!defined USE_SSECRC)
19+
#define USE_SSECRC
20+
#endif
2121
#else
22-
# undef USE_SSECRC
22+
#undef USE_SSECRC
2323
#endif
2424

2525
static LLVM_ATTRIBUTE_UNUSED inline size_t hash_int64_fallback(int64_t k) {
@@ -50,7 +50,7 @@ static inline size_t hash_int64_pair(int64_t k1, int64_t k2) {
5050
// crc32 is commutative, so we need to perturb k1 so that (k1, k2) hashes
5151
// differently from (k2, k1).
5252
k1 += k1;
53-
__asm("crc32q %1, %0\n" : "+r" (k1) : "rm"(k2));
53+
__asm("crc32q %1, %0\n" : "+r"(k1) : "rm"(k2));
5454
return k1;
5555
#else
5656
return (hash_int64(k1) << 1) ^ hash_int64(k2);
@@ -118,5 +118,5 @@ void CallGraph::adjustArcWeights() {
118118
}
119119
}
120120

121-
}
122-
}
121+
} // namespace bolt
122+
} // namespace llvm

bolt/lib/Passes/CallGraphWalker.cpp renamed to bolt/lib/Core/CallGraphWalker.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- bolt/Passes/CallGraphWalker.cpp ------------------------------------===//
1+
//===- bolt/Core/CallGraphWalker.cpp ------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "bolt/Passes/CallGraphWalker.h"
14-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
13+
#include "bolt/Core/CallGraphWalker.h"
14+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1515
#include "llvm/Support/CommandLine.h"
1616
#include "llvm/Support/Timer.h"
1717
#include <queue>

bolt/lib/Passes/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ add_llvm_library(LLVMBOLTPasses
44
AllocCombiner.cpp
55
AsmDump.cpp
66
BinaryPasses.cpp
7-
BinaryFunctionCallGraph.cpp
87
CMOVConversion.cpp
98
CacheMetrics.cpp
10-
CallGraph.cpp
11-
CallGraphWalker.cpp
129
DataflowAnalysis.cpp
1310
DataflowInfoManager.cpp
1411
FrameAnalysis.cpp

bolt/lib/Passes/FrameAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "bolt/Passes/FrameAnalysis.h"
14+
#include "bolt/Core/CallGraphWalker.h"
1415
#include "bolt/Core/ParallelUtilities.h"
15-
#include "bolt/Passes/CallGraphWalker.h"
1616
#include "llvm/MC/MCRegisterInfo.h"
1717
#include "llvm/Support/Timer.h"
1818
#include <fstream>

bolt/lib/Passes/FrameOptimizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "bolt/Passes/FrameOptimizer.h"
14+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1415
#include "bolt/Core/ParallelUtilities.h"
15-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
1616
#include "bolt/Passes/DataflowInfoManager.h"
1717
#include "bolt/Passes/ShrinkWrapping.h"
1818
#include "bolt/Passes/StackAvailableExpressions.h"

bolt/lib/Passes/IndirectCallPromotion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "bolt/Passes/IndirectCallPromotion.h"
14-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
14+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1515
#include "bolt/Passes/DataflowInfoManager.h"
1616
#include "bolt/Passes/Inliner.h"
1717
#include "llvm/ADT/STLExtras.h"

bolt/lib/Passes/JTFootprintReduction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "bolt/Passes/JTFootprintReduction.h"
14-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
14+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1515
#include "bolt/Passes/DataflowInfoManager.h"
1616
#include "llvm/Support/CommandLine.h"
1717

bolt/lib/Passes/RegAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "bolt/Passes/RegAnalysis.h"
1414
#include "bolt/Core/BinaryFunction.h"
15-
#include "bolt/Passes/CallGraphWalker.h"
15+
#include "bolt/Core/CallGraphWalker.h"
1616
#include "llvm/MC/MCRegisterInfo.h"
1717
#include "llvm/Support/CommandLine.h"
1818

bolt/lib/Passes/RegReAssign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "bolt/Passes/RegReAssign.h"
14+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1415
#include "bolt/Core/MCPlus.h"
15-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
1616
#include "bolt/Passes/DataflowAnalysis.h"
1717
#include "bolt/Passes/DataflowInfoManager.h"
1818
#include "bolt/Utils/Utils.h"

bolt/lib/Passes/StokeInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "bolt/Passes/StokeInfo.h"
14-
#include "bolt/Passes/BinaryFunctionCallGraph.h"
14+
#include "bolt/Core/BinaryFunctionCallGraph.h"
1515
#include "bolt/Passes/DataflowInfoManager.h"
1616
#include "llvm/Support/CommandLine.h"
1717

0 commit comments

Comments
 (0)