[Mlir-commits] [mlir] [mlir] Add the concept of ASM dialect aliases (PR #86033)
Fabian Mora
llvmlistbot at llvm.org
Thu Mar 28 05:31:56 PDT 2024
================
@@ -0,0 +1,60 @@
+//===- AsmInterfaces.td - Asm Interfaces -------------------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains interfaces and other utilities for interacting with the
+// AsmParser and AsmPrinter.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_IR_ASMINTERFACES_TD
+#define MLIR_IR_ASMINTERFACES_TD
+
+include "mlir/IR/AttrTypeBase.td"
+include "mlir/IR/OpBase.td"
+
+//===----------------------------------------------------------------------===//
+// AttrAsmAliasAttrInterface
+//===----------------------------------------------------------------------===//
+
+def AttrAsmAliasAttrInterface : AttrInterface<"AttrAsmAliasAttrInterface"> {
+ let cppNamespace = "::mlir";
+ let description = [{
+ This interface allows aliasing an attribute between dialects, allowing
+ custom printing of an attribute by an external dialect.
+ }];
+ let methods = [
+ InterfaceMethod<[{
+ Returns the dialect responsible for printing and parsing the attribute
+ instance.
+ }],
+ "Dialect*", "getAliasDialect", (ins), [{}], [{}]
+ >
+ ];
+}
+
+//===----------------------------------------------------------------------===//
----------------
fabianmcg wrote:
Also worth nothing, that for `LLVMPointerType` this interface (`TypeAsmAliasTypeInterface`) solves the issue of printing in all circumstances.
https://github.com/llvm/llvm-project/pull/86033
More information about the Mlir-commits
mailing list