diff options
author | Jeremy Kun <jkun@google.com> | 2024-07-07 09:44:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-07 09:44:07 -0700 |
commit | 07c157a43534744bff8b9cf03a5ec8d19717ba72 (patch) | |
tree | 1bf75e677d414370998224c1a0b8fa3770e09006 /llvm/lib/IR/Module.cpp | |
parent | c65f8d881671c3c7966fbbc967b7c4ca063d989b (diff) | |
download | llvm-07c157a43534744bff8b9cf03a5ec8d19717ba72.zip llvm-07c157a43534744bff8b9cf03a5ec8d19717ba72.tar.gz llvm-07c157a43534744bff8b9cf03a5ec8d19717ba72.tar.bz2 |
[mlir] load dialect in parser for optional parameters (#96667)
https://github.com/llvm/llvm-project/pull/96242 fixed an issue where the
auto-generated parsers were not loading dialects whose namespaces are
not present in the textual IR. This required the attribute parameter to
be a tablegen def with its dialect information attached.
This fails when using parameter wrapper classes like
`OptionalParameter`. This came up because `RingAttr` uses
`OptionalParameter` for its second and third attributes.
`OptionalParameter` takes as input the C++ type as a string instead of
the tablegen def, and so it doesn't have a dialect member value to
trigger the fix from https://github.com/llvm/llvm-project/pull/96242.
The docs on this topic say the appropriate solution as overloading
`FieldParser` for a particular type.
This PR updates `FieldParser` for generic attributes to load the dialect
on demand. This requires `mlir-tblgen` to emit a `dialectName` static
field on the generated attribute class, and check for it with template
metaprogramming, since not all attribute types go through `mlir-tblgen`.
---------
Co-authored-by: Jeremy Kun <j2kun@users.noreply.github.com>
Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com>
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
0 files changed, 0 insertions, 0 deletions