[all-commits] [llvm/llvm-project] a04d31: [mlir-tblgen] Render enum keyword alternatives in ...
Maksim Levental via All-commits
all-commits at lists.llvm.org
Fri Jun 12 23:38:17 PDT 2026
Branch: refs/heads/users/makslevental/enum-parameter-doc-syntax
Home: https://github.com/llvm/llvm-project
Commit: a04d312f9dfcaf8cf98bd747d6c6bc2a1c08dedd
https://github.com/llvm/llvm-project/commit/a04d312f9dfcaf8cf98bd747d6c6bc2a1c08dedd
Author: Maksim Levental <maksim.levental at gmail.com>
Date: 2026-06-12 (Fri, 12 Jun 2026)
Changed paths:
M mlir/include/mlir/IR/EnumAttr.td
M mlir/test/mlir-tblgen/gen-dialect-doc.td
M mlir/tools/mlir-tblgen/OpDocGen.cpp
Log Message:
-----------
[mlir-tblgen] Render enum keyword alternatives in generated attr/type docs
When mlir-tblgen generates documentation for AttrDefs/TypeDefs that have
EnumParameter fields, it previously rendered the raw C++ type (e.g.
`::mlir::air::BufferAccess`) in the syntax block. This was unhelpful for
users who need to know the valid keyword values.
This patch:
1. Adds an `EnumInfo enum = enumInfo;` field to the `EnumParameter`
TableGen class, persisting the enum record for tooling to inspect.
2. Modifies `emitAttrOrTypeDefAssemblyFormat` in OpDocGen.cpp to detect
EnumParameter fields and render their cases as backtick-quoted
alternatives (e.g. `` `read` | `read_write` ``).
3. Adds a test case to gen-dialect-doc.td verifying the new behavior.
Before:
#air.kernel_arg<
int32_t, # index
::mlir::air::BufferAccess, # access
>
After:
#air.kernel_arg<
int32_t, # index
`read` | `read_write`, # access
>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply at anthropic.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list