diff --git a/mlir/docs/OpDefinitions.md b/mlir/docs/OpDefinitions.md --- a/mlir/docs/OpDefinitions.md +++ b/mlir/docs/OpDefinitions.md @@ -746,9 +746,9 @@ identifier used as a suffix to these two calls, i.e., `custom(...)` would result in calls to `parseMyDirective` and `printMyDirective` wihtin the parser and printer respectively. `Params` may be any combination of variables -(i.e. Attribute, Operand, Successor, etc.) and type directives. The type -directives must refer to a variable, but that variable need not also be a -parameter to the custom directive. +(i.e. Attribute, Operand, Successor, etc.), type directives, and `attr-dict`. +The type directives must refer to a variable, but that variable need not also +be a parameter to the custom directive. The arguments to the `parse` method is firstly a reference to the `OpAsmParser`(`OpAsmParser &`), and secondly a set of output parameters diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp --- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp +++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp @@ -845,7 +845,8 @@ body << ", "; if (auto *attr = dyn_cast(¶m)) { body << attr->getVar()->name << "Attr"; - + } else if (auto *attrDict = dyn_cast(¶m)) { + body << "result.attributes"; } else if (auto *operand = dyn_cast(¶m)) { StringRef name = operand->getVar()->name; ArgumentLengthKind lengthKind = getArgumentLengthKind(operand->getVar()); @@ -1478,7 +1479,8 @@ body << ", "; if (auto *attr = dyn_cast(¶m)) { body << attr->getVar()->name << "Attr()"; - + } else if (auto *attrDict = dyn_cast(¶m)) { + body << "this"; } else if (auto *operand = dyn_cast(¶m)) { body << operand->getVar()->name << "()"; @@ -2735,8 +2737,9 @@ return ::mlir::failure(); // Verify that the element can be placed within a custom directive. - if (!isa(parameters.back().get())) { + if (!isa(parameters.back().get())) { return emitError(childLoc, "only variables and types may be used as " "parameters to a custom directive"); }