[llvm] [mlir] [MLIR] convert OpAsmDialectInterface using ODS (PR #171488)

Jacques Pienaar via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 07:24:32 PST 2025


================
@@ -0,0 +1,78 @@
+#ifndef MLIR_INTERFACES_OPASMDIALECTINTERFACE
+#define MLIR_INTERFACES_OPASMDIALECTINTERFACE
+
+include "mlir/IR/Interfaces.td"
+
+def OpAsmDialectInterface : DialectInterface<"OpAsmDialectInterface"> {
+  let description = [{
+    Dialect OpAsm interface
+  }];
+  let cppNamespace = "::mlir";
+  let aliasDeclarations = [AliasDeclaration<"AliasResult", "OpAsmAliasResult">];
+
+  let methods = [
+    InterfaceMethod<[{
+        Hooks for getting an alias identifier alias for a given symbol, that is
+        not necessarily a part of this dialect. The identifier is used in place of
+        the symbol when printing textual IR. These aliases must not contain `.` or
+        end with a numeric digit([0-9]+).
+      }],
+      "AliasResult", "getAlias",
+      (ins "::mlir::Attribute":$attr, "::llvm::raw_ostream &":$os),
+      [{
+        return AliasResult::NoAlias;
+      }]
+    >,
+    InterfaceMethod<[{}], "AliasResult", "getAlias",
+      (ins "::mlir::Type":$type, "::llvm::raw_ostream &":$os),
+      [{
+        return AliasResult::NoAlias;
+      }]
+    >,
+    InterfaceMethod<[{
+        Declare a resource with the given key, returning a handle to use for any
+        references of this resource key within the IR during parsing. The result
+        of `getResourceKey` on the returned handle is permitted to be different
+        than `key`.
+      }],
+      "::mlir::FailureOr<AsmDialectResourceHandle>", "declareResource",
----------------
jpienaar wrote:

Should AsmDialectResourceHandle also be qualified?

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


More information about the llvm-commits mailing list