[llvm-branch-commits] [mlir] [mlir] Start moving some builtin type formats to the dialect (PR #80421)

Markus Böck via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Feb 2 13:26:28 PST 2024


================
@@ -25,7 +25,8 @@ include "mlir/IR/BuiltinTypeInterfaces.td"
 // Base class for Builtin dialect types.
 class Builtin_Type<string name, string typeMnemonic, list<Trait> traits = [],
                    string baseCppClass = "::mlir::Type">
-    : TypeDef<Builtin_Dialect, name, traits, baseCppClass> {
+    : TypeDef<Builtin_Dialect, name, !listconcat(traits, [PrintTypeQualified]),
----------------
zero9178 wrote:

The best example as to why this is needed is probably `complex`. Not using `PrintTypeQualified` means changing the syntax of ALL operations in the complex dialect as they all suddenly use the unqualified syntax. 
Additionally, `parseCustomTypeWithFallback` currently does not handle the builtin types correctly if written verbose (e.g. `complex<f32>`) since the logic currently assumes that verbose types always lead with the dialect name (`!builtin`).
I tried a bit what logic changes would be required and did not find an obvious answer. It therefore also breaks existing input parsing.
So to summarize:
* To stay compatible with existing syntax and tests and avoid creating massive churn
* To avoid incompatiblity with the current implementation of stripped parsing and printing

If you like I can take a closer look at fixing `parseCustomTypeWithFallback` here, but thought I'd rather make that a future PR to keep this one backwards compatible.

https://github.com/llvm/llvm-project/pull/80421


More information about the llvm-branch-commits mailing list