[PATCH] D77133: [mlir] Add an out-of-tree dialect example

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 31 18:45:00 PDT 2020


rriddle added inline comments.


================
Comment at: mlir/examples/standalone/lib/Standalone/StandaloneOps.cpp:22
+  // Parse the custom assembly format.
+  if (parser.parseOperand(operand) ||
+      parser.parseOptionalAttrDict(result.attributes) ||
----------------
Kayjukh wrote:
> rriddle wrote:
> > Should you be using the declarative assembly format instead?
> > 
> > https://mlir.llvm.org/docs/OpDefinitions/#declarative-assembly-format
> I considered using the declarative syntax at first, but I think using a custom parser and printer illustrates a more general (albeit rare) case where you might want to do more during parsing than what is done by the generated parser.
> 
> But as I said in a previous update comment, I am very much open to discussion on this point. I don't know if it is relevant to account for such corner cases in an example dialect.
It all depends on what you are trying to convey with your example. Given that examples are generally used as a template, I would rather do the right thing instead. For example, you could have defined the operation classes manually in C++ but you didn't. Why shouldn't the same apply to the assembly format?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77133/new/

https://reviews.llvm.org/D77133





More information about the llvm-commits mailing list