[llvm] 7251243 - [CodeGen][Passes] Move `CodeGenPassBuilder.h` to Passes (#79242)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 19:29:22 PST 2024
Author: paperchalice
Date: 2024-01-24T11:29:18+08:00
New Revision: 7251243315ef66f9b3f32e6f8e9536f701aa0d0a
URL: https://github.com/llvm/llvm-project/commit/7251243315ef66f9b3f32e6f8e9536f701aa0d0a
DIFF: https://github.com/llvm/llvm-project/commit/7251243315ef66f9b3f32e6f8e9536f701aa0d0a.diff
LOG: [CodeGen][Passes] Move `CodeGenPassBuilder.h` to Passes (#79242)
`CodeGenPassBuilder` is not very tightly coupled to CodeGen, it may need
to reference some method in pass builder in future, so move
`CodeGenPassBuilder.h` to Passes.
Added:
llvm/include/llvm/Passes/CodeGenPassBuilder.h
llvm/include/llvm/Passes/MachinePassRegistry.def
llvm/lib/Passes/CodeGenPassBuilder.cpp
Modified:
llvm/include/module.modulemap
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/Passes/CMakeLists.txt
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
llvm/tools/llc/NewPMDriver.cpp
Removed:
llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
llvm/include/llvm/CodeGen/MachinePassRegistry.def
llvm/lib/CodeGen/CodeGenPassBuilder.cpp
################################################################################
diff --git a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
similarity index 99%
rename from llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
rename to llvm/include/llvm/Passes/CodeGenPassBuilder.h
index 96d6f891af4e2d7..07afac3bcf8401f 100644
--- a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -12,8 +12,8 @@
///
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CODEGEN_CODEGENPASSBUILDER_H
-#define LLVM_CODEGEN_CODEGENPASSBUILDER_H
+#ifndef LLVM_PASSES_CODEGENPASSBUILDER_H
+#define LLVM_PASSES_CODEGENPASSBUILDER_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
@@ -116,7 +116,7 @@ namespace llvm {
} \
static AnalysisKey Key; \
};
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
/// This class provides access to building LLVM's passes.
///
@@ -676,7 +676,7 @@ CodeGenPassBuilder<Derived>::getPassNameFromLegacyName(StringRef Name) const {
#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
if (Name == NAME) \
Ret = {#PASS_NAME, true};
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
if (Ret.first.empty())
Ret = derived().getTargetPassNameFromLegacyName(Name);
@@ -1235,4 +1235,4 @@ void CodeGenPassBuilder<Derived>::addBlockPlacement(
} // namespace llvm
-#endif // LLVM_CODEGEN_CODEGENPASSBUILDER_H
+#endif // LLVM_PASSES_CODEGENPASSBUILDER_H
diff --git a/llvm/include/llvm/CodeGen/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def
similarity index 100%
rename from llvm/include/llvm/CodeGen/MachinePassRegistry.def
rename to llvm/include/llvm/Passes/MachinePassRegistry.def
diff --git a/llvm/include/module.modulemap b/llvm/include/module.modulemap
index 8930fa8c087cf4c..b19929fb9adfd4d 100644
--- a/llvm/include/module.modulemap
+++ b/llvm/include/module.modulemap
@@ -46,11 +46,8 @@ module LLVM_Backend {
exclude header "llvm/CodeGen/LinkAllAsmWriterComponents.h"
exclude header "llvm/CodeGen/LinkAllCodegenComponents.h"
- exclude header "llvm/CodeGen/CodeGenPassBuilder.h"
-
// These are intended for (repeated) textual inclusion.
textual header "llvm/CodeGen/DIEValue.def"
- textual header "llvm/CodeGen/MachinePassRegistry.def"
}
}
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index df2d1831ee5fdbf..28c32116b2ba50d 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -56,7 +56,6 @@ add_llvm_component_library(LLVMCodeGen
CFIInstrInserter.cpp
CodeGen.cpp
CodeGenCommonISel.cpp
- CodeGenPassBuilder.cpp
CodeGenPrepare.cpp
CommandFlags.cpp
ComplexDeinterleavingPass.cpp
diff --git a/llvm/lib/Passes/CMakeLists.txt b/llvm/lib/Passes/CMakeLists.txt
index 98d2de76c0e1147..6425f4934b21034 100644
--- a/llvm/lib/Passes/CMakeLists.txt
+++ b/llvm/lib/Passes/CMakeLists.txt
@@ -1,4 +1,5 @@
add_llvm_component_library(LLVMPasses
+ CodeGenPassBuilder.cpp
OptimizationLevel.cpp
PassBuilder.cpp
PassBuilderBindings.cpp
diff --git a/llvm/lib/CodeGen/CodeGenPassBuilder.cpp b/llvm/lib/Passes/CodeGenPassBuilder.cpp
similarity index 87%
rename from llvm/lib/CodeGen/CodeGenPassBuilder.cpp
rename to llvm/lib/Passes/CodeGenPassBuilder.cpp
index 82945528e76802a..c0319e5d6e404a3 100644
--- a/llvm/lib/CodeGen/CodeGenPassBuilder.cpp
+++ b/llvm/lib/Passes/CodeGenPassBuilder.cpp
@@ -11,17 +11,17 @@
//
//===---------------------------------------------------------------------===//
-#include "llvm/CodeGen/CodeGenPassBuilder.h"
+#include "llvm/Passes/CodeGenPassBuilder.h"
using namespace llvm;
namespace llvm {
#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
MachinePassKey PASS_NAME::Key;
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
#define DUMMY_MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
MachinePassKey PASS_NAME::Key;
#define DUMMY_MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \
AnalysisKey PASS_NAME::Key;
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
} // namespace llvm
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 000594f0e7f4b51..2fe167bd439d487 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -400,7 +400,7 @@ PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
PIC->addClassToPassName(PASS_NAME::name(), NAME);
#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
PIC->addClassToPassName(PASS_NAME::name(), NAME);
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
}
}
@@ -441,7 +441,7 @@ void PassBuilder::registerMachineFunctionAnalyses(
#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \
MFAM.registerPass([&] { return PASS_NAME(); });
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
for (auto &C : MachineFunctionAnalysisRegistrationCallbacks)
C(MFAM);
@@ -1868,7 +1868,7 @@ Error PassBuilder::parseMachinePass(MachineFunctionPassManager &MFPM,
MFPM.addPass(PASS_NAME()); \
return Error::success(); \
}
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
for (auto &C : MachinePipelineParsingCallbacks)
if (C(Name, MFPM))
@@ -2179,17 +2179,17 @@ void PassBuilder::printPassNames(raw_ostream &OS) {
OS << "Machine module passes (WIP):\n";
#define MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
printPassName(NAME, OS);
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
OS << "Machine function passes (WIP):\n";
#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
printPassName(NAME, OS);
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
OS << "Machine function analyses (WIP):\n";
#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \
printPassName(NAME, OS);
-#include "llvm/CodeGen/MachinePassRegistry.def"
+#include "llvm/Passes/MachinePassRegistry.def"
}
void PassBuilder::registerParseTopLevelPipelineCallback(
diff --git a/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp b/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
index 616f777833e565c..4a11dd2e31acdef 100644
--- a/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
+++ b/llvm/lib/Target/X86/X86CodeGenPassBuilder.cpp
@@ -12,8 +12,8 @@
#include "X86TargetMachine.h"
-#include "llvm/CodeGen/CodeGenPassBuilder.h"
#include "llvm/MC/MCStreamer.h"
+#include "llvm/Passes/CodeGenPassBuilder.h"
using namespace llvm;
diff --git a/llvm/tools/llc/NewPMDriver.cpp b/llvm/tools/llc/NewPMDriver.cpp
index 13020f3dd07feba..2f979f3081f795f 100644
--- a/llvm/tools/llc/NewPMDriver.cpp
+++ b/llvm/tools/llc/NewPMDriver.cpp
@@ -15,7 +15,6 @@
#include "NewPMDriver.h"
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/CodeGen/CodeGenPassBuilder.h"
#include "llvm/CodeGen/CommandFlags.h"
#include "llvm/CodeGen/MIRParser/MIRParser.h"
#include "llvm/CodeGen/MIRPrinter.h"
@@ -30,6 +29,7 @@
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IRReader/IRReader.h"
+#include "llvm/Passes/CodeGenPassBuilder.h" // TODO: Include pass headers properly.
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Passes/StandardInstrumentations.h"
#include "llvm/Support/CommandLine.h"
More information about the llvm-commits
mailing list