[llvm] 7ac7d41 - [NewPM][NVPTX] Add NVPTXPassRegistry.def NFCI (#86246)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 20:20:22 PDT 2024
Author: paperchalice
Date: 2024-03-23T11:20:18+08:00
New Revision: 7ac7d418ac2b16fd44789dcf48e2b5d73de3e715
URL: https://github.com/llvm/llvm-project/commit/7ac7d418ac2b16fd44789dcf48e2b5d73de3e715
DIFF: https://github.com/llvm/llvm-project/commit/7ac7d418ac2b16fd44789dcf48e2b5d73de3e715.diff
LOG: [NewPM][NVPTX] Add NVPTXPassRegistry.def NFCI (#86246)
Prepare for dag-isel migration.
Added:
llvm/lib/Target/NVPTX/NVPTXPassRegistry.def
Modified:
llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/NVPTX/NVPTXPassRegistry.def b/llvm/lib/Target/NVPTX/NVPTXPassRegistry.def
new file mode 100644
index 00000000000000..6ff15ab6f13c44
--- /dev/null
+++ b/llvm/lib/Target/NVPTX/NVPTXPassRegistry.def
@@ -0,0 +1,40 @@
+//===- NVPTXPassRegistry.def - Registry of NVPTX passes ---------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is used as the registry of passes that are part of the
+// NVPTX backend.
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: NO INCLUDE GUARD DESIRED!
+
+#ifndef MODULE_PASS
+#define MODULE_PASS(NAME, CREATE_PASS)
+#endif
+MODULE_PASS("generic-to-nvvm", GenericToNVVMPass())
+MODULE_PASS("nvptx-lower-ctor-dtor", NVPTXCtorDtorLoweringPass())
+#undef MODULE_PASS
+
+#ifndef FUNCTION_ANALYSIS
+#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
+#endif
+
+#ifndef FUNCTION_ALIAS_ANALYSIS
+#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
+ FUNCTION_ANALYSIS(NAME, CREATE_PASS)
+#endif
+FUNCTION_ALIAS_ANALYSIS("nvptx-aa", NVPTXAA())
+#undef FUNCTION_ALIAS_ANALYSIS
+#undef FUNCTION_ANALYSIS
+
+#ifndef FUNCTION_PASS
+#define FUNCTION_PASS(NAME, CREATE_PASS)
+#endif
+FUNCTION_PASS("nvvm-intr-range", NVVMIntrRangePass())
+FUNCTION_PASS("nvvm-reflect", NVVMReflectPass())
+#undef FUNCTION_PASS
diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
index 69d4596f7843e4..78f48652c9920f 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -227,45 +227,8 @@ void NVPTXTargetMachine::registerDefaultAliasAnalyses(AAManager &AAM) {
void NVPTXTargetMachine::registerPassBuilderCallbacks(
PassBuilder &PB, bool PopulateClassToPassNames) {
- PB.registerPipelineParsingCallback(
- [](StringRef PassName, FunctionPassManager &PM,
- ArrayRef<PassBuilder::PipelineElement>) {
- if (PassName == "nvvm-reflect") {
- PM.addPass(NVVMReflectPass());
- return true;
- }
- if (PassName == "nvvm-intr-range") {
- PM.addPass(NVVMIntrRangePass());
- return true;
- }
- return false;
- });
-
- PB.registerAnalysisRegistrationCallback([](FunctionAnalysisManager &FAM) {
- FAM.registerPass([&] { return NVPTXAA(); });
- });
-
- PB.registerParseAACallback([](StringRef AAName, AAManager &AAM) {
- if (AAName == "nvptx-aa") {
- AAM.registerFunctionAnalysis<NVPTXAA>();
- return true;
- }
- return false;
- });
-
- PB.registerPipelineParsingCallback(
- [](StringRef PassName, ModulePassManager &PM,
- ArrayRef<PassBuilder::PipelineElement>) {
- if (PassName == "nvptx-lower-ctor-dtor") {
- PM.addPass(NVPTXCtorDtorLoweringPass());
- return true;
- }
- if (PassName == "generic-to-nvvm") {
- PM.addPass(GenericToNVVMPass());
- return true;
- }
- return false;
- });
+#define GET_PASS_REGISTRY "NVPTXPassRegistry.def"
+#include "llvm/Passes/TargetPassRegistry.inc"
PB.registerPipelineStartEPCallback(
[this](ModulePassManager &PM, OptimizationLevel Level) {
More information about the llvm-commits
mailing list