[Mlir-commits] [mlir] d25beca - [MLIR][Doc] Update the pass infra doc to advise against `let constructor = ` (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Mon Feb 17 05:56:39 PST 2025
Author: Mehdi Amini
Date: 2025-02-17T14:56:21+01:00
New Revision: d25becaa2079b19e475902ca712cad5df3e660ee
URL: https://github.com/llvm/llvm-project/commit/d25becaa2079b19e475902ca712cad5df3e660ee
DIFF: https://github.com/llvm/llvm-project/commit/d25becaa2079b19e475902ca712cad5df3e660ee.diff
LOG: [MLIR][Doc] Update the pass infra doc to advise against `let constructor = ` (NFC)
We should avoid specifying it manually and instead rely on TableGen, see also
cleanups in #127403
Added:
Modified:
mlir/docs/PassManagement.md
Removed:
################################################################################
diff --git a/mlir/docs/PassManagement.md b/mlir/docs/PassManagement.md
index 9fb0aaab06461..eda48a44cf023 100644
--- a/mlir/docs/PassManagement.md
+++ b/mlir/docs/PassManagement.md
@@ -809,11 +809,6 @@ def MyPass : Pass<"my-pass", "ModuleOp"> {
its various constraints and behavior.
}];
- // A constructor must be provided to specify how to create a default instance
- // of MyPass. It can be skipped for this specific example, because both the
- // constructor and the registration methods live in the same namespace.
- let constructor = "foo::createMyPass()";
-
// Specify any options.
let options = [
Option<"option", "example-option", "bool", /*default=*/"true",
@@ -883,8 +878,7 @@ struct MyPassOptions {
#endif // GEN_PASS_DECL_MYPASS
```
-If the `constructor` field has not been specified in the tablegen declaration,
-then autogenerated file will also contain the declarations of the default
+The utogenerated file will also contain the declarations of the default
constructors.
```c++
@@ -927,9 +921,8 @@ struct MyPass : foo::impl::MyPassBase<MyPass> {
These definitions can be enabled on a per-pass basis by defining the appropriate
preprocessor `GEN_PASS_DEF_PASSNAME` macro, with `PASSNAME` equal to the
uppercase version of the name of the pass definition in tablegen.
-If the `constructor` field has not been specified in tablegen, then the default
-constructors are also defined and expect the name of the actual pass class to
-be equal to the name defined in tablegen.
+The default constructors are also defined and expect the name of the actual pass
+class to be equal to the name defined in tablegen.
Using the `gen-pass-doc` generator, markdown documentation for each of the
passes can be generated. See [Passes.md](Passes.md) for example output of real
@@ -951,12 +944,14 @@ contains the following fields:
* `dependentDialects`
- A list of strings representing the `Dialect` classes this pass may
introduce entities, Attributes/Operations/Types/etc., of.
-* `constructor`
- - A code block used to create a default instance of the pass.
* `options`
- A list of pass options used by the pass.
* `statistics`
- A list of pass statistics used by the pass.
+* `constructor`
+ - A code block used to create a default instance of the pass.
+ Specifying it will disable the constructors auto-generation for the
+ pass. This is a legacy option, it is not advised to use it.
#### Options
More information about the Mlir-commits
mailing list