[Mlir-commits] [mlir] [mlir] Add the concept of ASM dialect aliases (PR #86033)
Fabian Mora
llvmlistbot at llvm.org
Thu Mar 28 09:13:58 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();
+ }
+
----------------
fabianmcg wrote:
Yes. I introduced this methods just to make it easier to have aliases without having to implement the `parseType` function in the dialect. However, if the plan is to have this backed this by ODS at some point, then there's no need for them.
https://github.com/llvm/llvm-project/pull/86033
More information about the Mlir-commits
mailing list