-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[MLIR][NFC] Retire let constructor for EmitC #133732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MLIR][NFC] Retire let constructor for EmitC #133732
Conversation
@llvm/pr-subscribers-mlir Author: lorenzo chelini (chelini) ChangesFull diff: https://github.com/llvm/llvm-project/pull/133732.diff 3 Files Affected:
diff --git a/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h b/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h
index 5cd27149d366e..5a103f181c76b 100644
--- a/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h
@@ -14,12 +14,8 @@
namespace mlir {
namespace emitc {
-//===----------------------------------------------------------------------===//
-// Passes
-//===----------------------------------------------------------------------===//
-
-/// Creates an instance of the C-style expressions forming pass.
-std::unique_ptr<Pass> createFormExpressionsPass();
+#define GEN_PASS_DECL_FORMEXPRESSIONSPASS
+#include "mlir/Dialect/EmitC/Transforms/Passes.h.inc"
//===----------------------------------------------------------------------===//
// Registration
diff --git a/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td b/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td
index fd083abc95715..f46b705ca2dfe 100644
--- a/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td
@@ -11,13 +11,12 @@
include "mlir/Pass/PassBase.td"
-def FormExpressions : Pass<"form-expressions"> {
+def FormExpressionsPass : Pass<"form-expressions"> {
let summary = "Form C-style expressions from C-operator ops";
let description = [{
The pass wraps emitc ops modelling C operators in emitc.expression ops and
then folds single-use expressions into their users where possible.
}];
- let constructor = "mlir::emitc::createFormExpressionsPass()";
let dependentDialects = ["emitc::EmitCDialect"];
}
diff --git a/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp b/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp
index 3385514375804..224d68ab8b4a6 100644
--- a/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp
+++ b/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp
@@ -18,7 +18,7 @@
namespace mlir {
namespace emitc {
-#define GEN_PASS_DEF_FORMEXPRESSIONS
+#define GEN_PASS_DEF_FORMEXPRESSIONSPASS
#include "mlir/Dialect/EmitC/Transforms/Passes.h.inc"
} // namespace emitc
} // namespace mlir
@@ -28,7 +28,7 @@ using namespace emitc;
namespace {
struct FormExpressionsPass
- : public emitc::impl::FormExpressionsBase<FormExpressionsPass> {
+ : public emitc::impl::FormExpressionsPassBase<FormExpressionsPass> {
void runOnOperation() override {
Operation *rootOp = getOperation();
MLIRContext *context = rootOp->getContext();
@@ -56,7 +56,3 @@ struct FormExpressionsPass
}
};
} // namespace
-
-std::unique_ptr<Pass> mlir::emitc::createFormExpressionsPass() {
- return std::make_unique<FormExpressionsPass>();
-}
|
@llvm/pr-subscribers-mlir-emitc Author: lorenzo chelini (chelini) ChangesFull diff: https://github.com/llvm/llvm-project/pull/133732.diff 3 Files Affected:
diff --git a/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h b/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h
index 5cd27149d366e..5a103f181c76b 100644
--- a/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h
@@ -14,12 +14,8 @@
namespace mlir {
namespace emitc {
-//===----------------------------------------------------------------------===//
-// Passes
-//===----------------------------------------------------------------------===//
-
-/// Creates an instance of the C-style expressions forming pass.
-std::unique_ptr<Pass> createFormExpressionsPass();
+#define GEN_PASS_DECL_FORMEXPRESSIONSPASS
+#include "mlir/Dialect/EmitC/Transforms/Passes.h.inc"
//===----------------------------------------------------------------------===//
// Registration
diff --git a/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td b/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td
index fd083abc95715..f46b705ca2dfe 100644
--- a/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td
@@ -11,13 +11,12 @@
include "mlir/Pass/PassBase.td"
-def FormExpressions : Pass<"form-expressions"> {
+def FormExpressionsPass : Pass<"form-expressions"> {
let summary = "Form C-style expressions from C-operator ops";
let description = [{
The pass wraps emitc ops modelling C operators in emitc.expression ops and
then folds single-use expressions into their users where possible.
}];
- let constructor = "mlir::emitc::createFormExpressionsPass()";
let dependentDialects = ["emitc::EmitCDialect"];
}
diff --git a/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp b/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp
index 3385514375804..224d68ab8b4a6 100644
--- a/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp
+++ b/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp
@@ -18,7 +18,7 @@
namespace mlir {
namespace emitc {
-#define GEN_PASS_DEF_FORMEXPRESSIONS
+#define GEN_PASS_DEF_FORMEXPRESSIONSPASS
#include "mlir/Dialect/EmitC/Transforms/Passes.h.inc"
} // namespace emitc
} // namespace mlir
@@ -28,7 +28,7 @@ using namespace emitc;
namespace {
struct FormExpressionsPass
- : public emitc::impl::FormExpressionsBase<FormExpressionsPass> {
+ : public emitc::impl::FormExpressionsPassBase<FormExpressionsPass> {
void runOnOperation() override {
Operation *rootOp = getOperation();
MLIRContext *context = rootOp->getContext();
@@ -56,7 +56,3 @@ struct FormExpressionsPass
}
};
} // namespace
-
-std::unique_ptr<Pass> mlir::emitc::createFormExpressionsPass() {
- return std::make_unique<FormExpressionsPass>();
-}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chelini! I am not sure about the naming convention, but I was wondering if FormExpressions.cpp
should be renamed to FormExpressionsPass.cpp
or if we should stick with def FormExpressions
and update the function calls accordingly? I could take over if you like me to.
@marbre, feel free to change it. Can I merge this one or you want to push on this PR? |
Whatever works best for you :) |
Ok, then please follow-up. I will merge this. |
`let constructor` is legacy (do not use in tree!) since the tableGen backend emits most of the glue logic to build a pass.
let constructor
is legacy (do not use in tree!) since the tableGenbackend emits most of the glue logic to build a pass.