[flang-commits] [flang] [flang][OpenMP][NFC] Reduce OMPMarkDeclareTarget boilerplate (PR #93797)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Thu May 30 03:05:35 PDT 2024


https://github.com/tblah created https://github.com/llvm/llvm-project/pull/93797

The pass constructor can be generated automatically by tablegen.

This pass does not need adapting to work with non-function top level operations because it operates specifically on call operations inside of an OpenMP declare target function.

>From dd66e9d5494a696402b8b41bbe9d8326ca2dd052 Mon Sep 17 00:00:00 2001
From: Tom Eccles <tom.eccles at arm.com>
Date: Thu, 23 May 2024 11:25:09 +0000
Subject: [PATCH] [flang][OpenMP][NFC] Reduce OMPMarkDeclareTarget boilerplate

The pass constructor can be generated automatically by tablegen.

This pass does not need adapting to work with non-function top level
operations because it operates specifically on call operations inside of
an OpenMP declare target function.
---
 flang/include/flang/Optimizer/Transforms/Passes.h       | 3 +--
 flang/include/flang/Optimizer/Transforms/Passes.td      | 1 -
 flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp | 7 -------
 3 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/flang/include/flang/Optimizer/Transforms/Passes.h b/flang/include/flang/Optimizer/Transforms/Passes.h
index 151719ea71ef0..46c38d107eec3 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.h
+++ b/flang/include/flang/Optimizer/Transforms/Passes.h
@@ -52,6 +52,7 @@ namespace fir {
 #define GEN_PASS_DECL_LOOPVERSIONING
 #define GEN_PASS_DECL_ADDALIASTAGS
 #define GEN_PASS_DECL_OMPMAPINFOFINALIZATIONPASS
+#define GEN_PASS_DECL_OMPMARKDECLARETARGETPASS
 #include "flang/Optimizer/Transforms/Passes.h.inc"
 
 std::unique_ptr<mlir::Pass> createAffineDemotionPass();
@@ -72,8 +73,6 @@ std::unique_ptr<mlir::Pass>
 createAlgebraicSimplificationPass(const mlir::GreedyRewriteConfig &config);
 
 std::unique_ptr<mlir::Pass> createOMPFunctionFilteringPass();
-std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
-createOMPMarkDeclareTargetPass();
 
 std::unique_ptr<mlir::Pass> createVScaleAttrPass();
 std::unique_ptr<mlir::Pass>
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index b0f1ad61251ce..f03412807d40a 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -337,7 +337,6 @@ def OMPMapInfoFinalizationPass
 def OMPMarkDeclareTargetPass
     : Pass<"omp-mark-declare-target", "mlir::ModuleOp"> {
   let summary = "Marks all functions called by an OpenMP declare target function as declare target";
-  let constructor = "::fir::createOMPMarkDeclareTargetPass()";
   let dependentDialects = ["mlir::omp::OpenMPDialect"];
 }
 
diff --git a/flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp b/flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp
index bebcb2a4f5687..4946e13b22865 100644
--- a/flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp
+++ b/flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp
@@ -88,10 +88,3 @@ class OMPMarkDeclareTargetPass
 };
 
 } // namespace
-
-namespace fir {
-std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
-createOMPMarkDeclareTargetPass() {
-  return std::make_unique<OMPMarkDeclareTargetPass>();
-}
-} // namespace fir



More information about the flang-commits mailing list