[Mlir-commits] [mlir] 5fee925 - [mlir][Pass] Update the documentation for the declarative pass specification
River Riddle
llvmlistbot at llvm.org
Tue Apr 7 14:22:07 PDT 2020
Author: River Riddle
Date: 2020-04-07T14:21:32-07:00
New Revision: 5fee925bebe002eb4b44ba4e2d5847ba417a344d
URL: https://github.com/llvm/llvm-project/commit/5fee925bebe002eb4b44ba4e2d5847ba417a344d
DIFF: https://github.com/llvm/llvm-project/commit/5fee925bebe002eb4b44ba4e2d5847ba417a344d.diff
LOG: [mlir][Pass] Update the documentation for the declarative pass specification
The pass tablegen backend now generates base classes instead of utilities, so this revision updates the documentation to reflect that.
Added:
Modified:
mlir/docs/WritingAPass.md
Removed:
################################################################################
diff --git a/mlir/docs/WritingAPass.md b/mlir/docs/WritingAPass.md
index 1ea253681783..4fd9ceda32fd 100644
--- a/mlir/docs/WritingAPass.md
+++ b/mlir/docs/WritingAPass.md
@@ -568,7 +568,7 @@ documentation.
Consider the following pass specified in C++:
```c++
-struct MyPass : OperationPass<MyPass> {
+struct MyPass : PassWrapper<MyPass, OperationPass<ModuleOp>> {
...
/// Options.
@@ -595,7 +595,7 @@ static PassRegistration<MyPass> pass("my-pass", "My pass summary");
This pass may be specified declaratively as so:
```tablegen
-def MyPass : Pass<"my-pass"> {
+def MyPass : Pass<"my-pass", "ModuleOp"> {
let summary = "My Pass Summary";
let description = [{
Here we can now give a much larger description of `MyPass`, including all of
@@ -636,11 +636,12 @@ void registerMyPasses() {
We can then update the original C++ pass definition:
```c++
-struct MyPass : OperationPass<MyPass> {
-/// Include the generated pass utilities.
-#define GEN_PASS_MyPass
+/// Include the generated base pass class definitions.
+#define GEN_PASS_CLASSES
#include "Passes.h.inc"
+// Define the main class as deriving from the generated base class.
+struct MyPass : MyPassBase<MyPass> {
...
};
@@ -653,8 +654,9 @@ std::unique_ptr<Pass> foo::createMyPass() {
### Tablegen Specification
The `Pass` class is used to begin a new pass definition. This class takes as an
-argument the command line argument to attribute to the pass. It contains the
-following fields:
+argument the command line argument to attribute to the pass, as well as an
+optional string corresponding to the operation type that the pass operates on.
+It contains the following fields:
* summary
- A short one line summary of the pass, used as the description when
More information about the Mlir-commits
mailing list