[PATCH] D76573: [mlir] Revamp operation documentation generation

Jacques Pienaar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 09:15:09 PDT 2020


jpienaar marked an inline comment as done.
jpienaar added inline comments.


================
Comment at: mlir/tools/mlir-tblgen/OpDocGen.cpp:231
+                           ArrayRef<Type> types, raw_ostream &os) {
+  os << "# '" << dialect.getName() << "' Dialect definition\n\n";
+  emitIfNotEmpty(dialect.getSummary(), os);
----------------
bondhugula wrote:
> Should this be just changed to `dialect.getName() << " Dialect\n"? It's a bit odd to see Dialect -> Dialect 'xyz' definition here:
> https://mlir.llvm.org/docs/Dialects/
Yeah the weirdness was due to expecting that one could have multiple dialects in one file, which I don't think has happened really.


================
Comment at: mlir/tools/mlir-tblgen/OpDocGen.cpp:152
     os << "\n#### Attributes:\n\n";
-    if (op.getNumAttributes() > 0) {
-      os << "| Attribute | MLIR Type | Description |\n"
-         << "| :-------: | :-------: | ----------- |\n";
+    os << "```\n";
+    size_t longestAttr = 0, longestType = 0;
----------------
I'm pro a table here as then the formatting can be left to markdown generation/CSS etc. and so this produces the content and the formatting/"pretty" parts gets done by markdown generator (then switching between different formats, alternating highlights, left align/center align etc. can be left to the formatters). Markdown generators and CSS already have so many different nobs for all those things ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76573





More information about the llvm-commits mailing list