Skip to content

Commit d25beca

Browse files
committed
[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
1 parent 949e404 commit d25beca

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

mlir/docs/PassManagement.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -809,11 +809,6 @@ def MyPass : Pass<"my-pass", "ModuleOp"> {
809809
its various constraints and behavior.
810810
}];
811811
812-
// A constructor must be provided to specify how to create a default instance
813-
// of MyPass. It can be skipped for this specific example, because both the
814-
// constructor and the registration methods live in the same namespace.
815-
let constructor = "foo::createMyPass()";
816-
817812
// Specify any options.
818813
let options = [
819814
Option<"option", "example-option", "bool", /*default=*/"true",
@@ -883,8 +878,7 @@ struct MyPassOptions {
883878
#endif // GEN_PASS_DECL_MYPASS
884879
```
885880

886-
If the `constructor` field has not been specified in the tablegen declaration,
887-
then autogenerated file will also contain the declarations of the default
881+
The utogenerated file will also contain the declarations of the default
888882
constructors.
889883

890884
```c++
@@ -927,9 +921,8 @@ struct MyPass : foo::impl::MyPassBase<MyPass> {
927921
These definitions can be enabled on a per-pass basis by defining the appropriate
928922
preprocessor `GEN_PASS_DEF_PASSNAME` macro, with `PASSNAME` equal to the
929923
uppercase version of the name of the pass definition in tablegen.
930-
If the `constructor` field has not been specified in tablegen, then the default
931-
constructors are also defined and expect the name of the actual pass class to
932-
be equal to the name defined in tablegen.
924+
The default constructors are also defined and expect the name of the actual pass
925+
class to be equal to the name defined in tablegen.
933926
934927
Using the `gen-pass-doc` generator, markdown documentation for each of the
935928
passes can be generated. See [Passes.md](Passes.md) for example output of real
@@ -951,12 +944,14 @@ contains the following fields:
951944
* `dependentDialects`
952945
- A list of strings representing the `Dialect` classes this pass may
953946
introduce entities, Attributes/Operations/Types/etc., of.
954-
* `constructor`
955-
- A code block used to create a default instance of the pass.
956947
* `options`
957948
- A list of pass options used by the pass.
958949
* `statistics`
959950
- A list of pass statistics used by the pass.
951+
* `constructor`
952+
- A code block used to create a default instance of the pass.
953+
Specifying it will disable the constructors auto-generation for the
954+
pass. This is a legacy option, it is not advised to use it.
960955
961956
#### Options
962957

0 commit comments

Comments
 (0)