From 10bcc34a685f42c229c64158ceb7f20fa094d46c Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 22 Apr 2019 14:56:54 -0700 Subject: [PATCH] [TableGen] Clean up comments regarding op and result An op can have multiple results. Being explicit that we are binding to the whole op instead of one of the results. A way to bind to a specific result is yet to come. -- PiperOrigin-RevId: 244741137 --- mlir/include/mlir/IR/OpBase.td | 22 +++++++++++----------- mlir/tools/mlir-tblgen/RewriterGen.cpp | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td index 8e9fb57..e38d658 100644 --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -777,14 +777,14 @@ def outs; // The signature of the builder is always // // ```c++ -// static void build(Builder *builder, OperationState *result, +// static void build(Builder *builder, OperationState *state, // ...) { // ... // } // ``` // // To define a custom builder, the parameter list (*including* the `Builder -// *builder, OperationState *result` part) and body should be passed in +// *builder, OperationState *state` part) and body should be passed in // as separate template arguments to this class. This is because we generate // op declaration and definition into separate files. If an empty string is // passed in for `body`, then *only* the builder declaration will be @@ -942,21 +942,21 @@ def addBenefit; // // In the result pattern, `argN` can be used to refer to a previously bound // name, with potential transformations (e.g., using tAttr, etc.). `argN` can -// itself be nested DAG node. We can also bound names to op results to reference +// itself be nested DAG node. We can also bound names to ops to reference // them later in other result patterns. // // For example, // // ``` -// def : Pattern<(OneResultOp1:$res1 $arg0, $arg1), -// [(OneResultOp2:$res2 $arg0, $arg1), -// (OneResultOp3 $res2 (OneResultOp4))], -// [(IsStaticShapeTensorTypePred $res1)]>; +// def : Pattern<(OneResultOp1:$op1 $arg0, $arg1), +// [(OneResultOp2:$op2 $arg0, $arg1), +// (OneResultOp3 $op2 (OneResultOp4))], +// [(IsStaticShapeTensorTypePred $op1)]>; // ``` // // `$argN` is bound to the `OneResultOp1`'s N-th argument and used later to -// build `OneResultOp2`. `$res1` is bound to `OneResultOp1`'s result and used to -// check whether the result's shape is static. `$res2` is bound to the result of +// build `OneResultOp2`. `$op1` is bound to `OneResultOp1` and used to +// check whether the result's shape is static. `$op2` is bound to // `OneResultOp2` and used to build `OneResultOp3`. class Pattern results, list preds = [], dag benefitAdded = (addBenefit 0)> { @@ -1009,8 +1009,8 @@ class NativeCodeCall { // Common directives //===----------------------------------------------------------------------===// -// Directive used in result pattern to indicate that no new result op are -// generated, so to replace the matched DAG with an existing SSA value. +// Directive used in result pattern to indicate that no new op are generated, +// so to replace the matched DAG with an existing SSA value. def replaceWithValue; // Directive used in result pattern to indicate that no replacement is generated diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp index bbc961f..dad3035 100644 --- a/mlir/tools/mlir-tblgen/RewriterGen.cpp +++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp @@ -57,8 +57,8 @@ static Twine getBoundSymbol(const StringRef &symbol) { namespace { // A class for resolving symbols bound in patterns. // -// Symbols can be bound to op arguments/results in the source pattern and op -// results in result patterns. For example, in +// Symbols can be bound to op arguments and ops in the source pattern and ops +// in result patterns. For example, in // // ``` // def : Pattern<(SrcOp:$op1 $arg0, %arg1), @@ -72,7 +72,7 @@ namespace { // values. // // Note that we also generate local variables for unnamed DAG nodes, like -// `(ResOp3)` in the above. Since we don't bind a symbol to the result, the +// `(ResOp3)` in the above. Since we don't bind a symbol to the op, the // generated local variable will be implicitly named. Those implicit names are // not tracked in this class. class PatternSymbolResolver { -- 2.7.4