[WGSL][NFC] Switch to new pass generation tablegen definitions. (#18215)

Signed-off-by: hanhanW <hanhan0912@gmail.com>
diff --git a/compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel b/compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel
index df9743e..0fb2528 100644
--- a/compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel
+++ b/compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel
@@ -28,7 +28,6 @@
 iree_compiler_cc_library(
     name = "PassHeaders",
     hdrs = [
-        "PassDetail.h",
         "Passes.h",
         "Passes.h.inc",
     ],
diff --git a/compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt b/compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt
index 6fbca25..5b3c46f 100644
--- a/compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt
+++ b/compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt
@@ -23,7 +23,6 @@
   NAME
     PassHeaders
   HDRS
-    "PassDetail.h"
     "Passes.h"
     "Passes.h.inc"
   DEPS
diff --git a/compiler/src/iree/compiler/Codegen/WGSL/PassDetail.h b/compiler/src/iree/compiler/Codegen/WGSL/PassDetail.h
deleted file mode 100644
index 911453d..0000000
--- a/compiler/src/iree/compiler/Codegen/WGSL/PassDetail.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2023 The IREE Authors
-//
-// Licensed 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
-
-#ifndef IREE_COMPILER_CODEGEN_WGSL_PASS_DETAIL_H_
-#define IREE_COMPILER_CODEGEN_WGSL_PASS_DETAIL_H_
-
-#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Interfaces/FunctionInterfaces.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir::iree_compiler {
-
-#define GEN_PASS_CLASSES
-#include "iree/compiler/Codegen/WGSL/Passes.h.inc"
-
-} // namespace mlir::iree_compiler
-
-#endif // IREE_COMPILER_CODEGEN_WGSL_PASS_DETAIL_H_
diff --git a/compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp b/compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp
index 124aedb..f2dc2da 100644
--- a/compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp
+++ b/compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp
@@ -6,7 +6,6 @@
 
 #include "mlir/Transforms/Passes.h"
 
-#include "iree/compiler/Codegen/WGSL/PassDetail.h"
 #include "iree/compiler/Codegen/WGSL/Passes.h"
 #include "mlir/Pass/PassManager.h"
 
diff --git a/compiler/src/iree/compiler/Codegen/WGSL/Passes.h b/compiler/src/iree/compiler/Codegen/WGSL/Passes.h
index 63230a5..b377d1d 100644
--- a/compiler/src/iree/compiler/Codegen/WGSL/Passes.h
+++ b/compiler/src/iree/compiler/Codegen/WGSL/Passes.h
@@ -17,15 +17,13 @@
 
 namespace mlir::iree_compiler {
 
-// Removes push constants by replacing hal.interface.constant.loads with
-// hal.interface.binding.subspan + flow.dispatch.tensor.load.
-std::unique_ptr<InterfacePass<mlir::FunctionOpInterface>>
-createWGSLReplacePushConstantsPass();
-
 //----------------------------------------------------------------------------//
 // Register WGSL Passes
 //----------------------------------------------------------------------------//
 
+#define GEN_PASS_DECL
+#include "iree/compiler/Codegen/WGSL/Passes.h.inc" // IWYU pragma: keep
+
 void registerCodegenWGSLPasses();
 
 } // namespace mlir::iree_compiler
diff --git a/compiler/src/iree/compiler/Codegen/WGSL/Passes.td b/compiler/src/iree/compiler/Codegen/WGSL/Passes.td
index 04ef1f5..8a672dd 100644
--- a/compiler/src/iree/compiler/Codegen/WGSL/Passes.td
+++ b/compiler/src/iree/compiler/Codegen/WGSL/Passes.td
@@ -13,12 +13,11 @@
 // WGSL passes (keep alphabetical)
 //===---------------------------------------------------------------------===//
 
-def WGSLReplacePushConstants :
+def WGSLReplacePushConstantsPass :
     InterfacePass<"iree-wgsl-replace-push-constants", "mlir::FunctionOpInterface"> {
   let summary =
       "Replaces push constant loads with binding loads for when using "
       "WGSL without push constant support";
-  let constructor = "mlir::iree_compiler::createWGSLReplacePushConstantsPass()";
 }
 
 #endif // IREE_CODEGEN_WGSL_PASSES
diff --git a/compiler/src/iree/compiler/Codegen/WGSL/WGSLReplacePushConstants.cpp b/compiler/src/iree/compiler/Codegen/WGSL/WGSLReplacePushConstants.cpp
index 9b418c3..378a560 100644
--- a/compiler/src/iree/compiler/Codegen/WGSL/WGSLReplacePushConstants.cpp
+++ b/compiler/src/iree/compiler/Codegen/WGSL/WGSLReplacePushConstants.cpp
@@ -4,7 +4,6 @@
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-#include "iree/compiler/Codegen/WGSL/PassDetail.h"
 #include "iree/compiler/Codegen/WGSL/Passes.h"
 #include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
 #include "iree/compiler/Dialect/HAL/IR/HALDialect.h"
@@ -18,6 +17,9 @@
 
 namespace mlir::iree_compiler {
 
+#define GEN_PASS_DEF_WGSLREPLACEPUSHCONSTANTSPASS
+#include "iree/compiler/Codegen/WGSL/Passes.h.inc"
+
 namespace {
 
 // These must match what the runtime uses.
@@ -106,8 +108,9 @@
                                             setLayoutAttrs);
 }
 
-class WGSLReplacePushConstantsPass
-    : public WGSLReplacePushConstantsBase<WGSLReplacePushConstantsPass> {
+class WGSLReplacePushConstantsPass final
+    : public impl::WGSLReplacePushConstantsPassBase<
+          WGSLReplacePushConstantsPass> {
   void getDependentDialects(DialectRegistry &registry) const override {
     registry.insert<mlir::arith::ArithDialect, mlir::tensor::TensorDialect,
                     mlir::vector::VectorDialect, IREE::Flow::FlowDialect,
@@ -194,10 +197,4 @@
 };
 
 } // namespace
-
-std::unique_ptr<InterfacePass<mlir::FunctionOpInterface>>
-createWGSLReplacePushConstantsPass() {
-  return std::make_unique<WGSLReplacePushConstantsPass>();
-}
-
 } // namespace mlir::iree_compiler