llvm-project
797c073c - [mlir] Add dialect hooks for registering custom type and attribute alias printers

Commit
294 days ago
[mlir] Add dialect hooks for registering custom type and attribute alias printers This patch introduces a mechanism for dialects to register custom alias printers for types and attributes via the `OpAsmDialectInterface`. This allows dialects to provide alternative printed representations for types and attributes based on their TypeID, including types/attributes from other dialects. The new `registerAttrAliasPrinter` and `registerTypeAliasPrinter` virtual methods accept callbacks that register printers for specific TypeIDs. When printing, these custom printers are invoked in registration order, and the first one to produce output is used. The precedence for alias resolution is: 1. Explicit type/attribute aliases returned by `getAlias` 2. Dialect-specific alias printers registered via the new hooks 3. Default type/attribute printers Signed-off-by: Fabian Mora <fabian.mora-cordero@amd.com>
Author
Committer
Parents
Loading