Commit 3fc2f91
committed
[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 <[email protected]>1 parent b184f00 commit 3fc2f91
File tree
4 files changed
+310
-4
lines changed- mlir
- include/mlir/IR
- lib/IR
- test
- IR
- lib/Dialect/Test
4 files changed
+310
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
172 | 177 | | |
173 | 178 | | |
174 | 179 | | |
| |||
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
221 | 234 | | |
222 | 235 | | |
223 | 236 | | |
| |||
1799 | 1812 | | |
1800 | 1813 | | |
1801 | 1814 | | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
1802 | 1839 | | |
1803 | 1840 | | |
1804 | 1841 | | |
| |||
0 commit comments