[Mlir-commits] [mlir] [mlir] Add the concept of ASM dialect aliases (PR #86033)
Markus Böck
llvmlistbot at llvm.org
Thu Mar 28 05:48:23 PDT 2024
================
@@ -1729,6 +1732,29 @@ class OpAsmDialectInterface
return AliasResult::NoAlias;
}
+ /// Hooks for parsing a dialect alias. The method returns success if the
+ /// dialect has an alias for the symbol, otherwise it must return failure.
+ /// If there was an error during parsing, this method should return success
+ /// and set the attribute to null.
+ virtual LogicalResult parseDialectAlias(DialectAsmParser &parser,
+ Attribute &attr, Type type) const {
+ return failure();
+ }
+ virtual LogicalResult parseDialectAlias(DialectAsmParser &parser,
+ Type &type) const {
+ return failure();
+ }
+ /// Hooks for printing a dialect alias. The method returns success if the
+ /// dialect has an alias for the symbol, otherwise it must return failure.
+ virtual LogicalResult printDialectAlias(DialectAsmPrinter &printer,
+ Attribute attr) const {
+ return failure();
+ }
+ virtual LogicalResult printDialectAlias(DialectAsmPrinter &printer,
+ Type type) const {
+ return failure();
+ }
+
----------------
zero9178 wrote:
Why are these APIs required? When parsing and the parser sees a `!llvm`, it will call `dialect->parseType` right?
Similarily for printing, after the dialect that should be used for printing has been determined through the interface call, couldn't one just call `dialect->printType`?
https://github.com/llvm/llvm-project/pull/86033
More information about the Mlir-commits
mailing list