[Mlir-commits] [mlir] Add a polynomial dialect shell, attributes, and types (PR #72081)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Sun Apr 7 23:59:56 PDT 2024
================
@@ -0,0 +1,75 @@
+//===- PolynomialAttributes.td - polynomial dialect attrs --*- 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
+//
+//===----------------------------------------------------------------------===//
+#ifndef POLYNOMIAL_ATTRIBUTES
+#define POLYNOMIAL_ATTRIBUTES
+
+include "PolynomialDialect.td"
+include "mlir/IR/BuiltinAttributes.td"
+include "mlir/IR/OpBase.td"
+
+class Polynomial_Attr<string name, string attrMnemonic, list<Trait> traits = []>
+ : AttrDef<Polynomial_Dialect, name, traits> {
+ let mnemonic = attrMnemonic;
+}
+
+def Polynomial_PolynomialAttr : Polynomial_Attr<"Polynomial", "polynomial"> {
+ let summary = "An attribute containing a single-variable polynomial.";
+ let description = [{
+ #poly = #polynomial.poly<x**1024 + 1>
+ }];
+ let parameters = (ins "Polynomial":$polynomial);
----------------
ftynse wrote:
Just to confirm that this works as I'd expect: does making `Polynomial` hashable ensure that `PolynomialAttr` containing equal polynomials are actually the same attribute, as in, pointing to the same impl pointer?
https://github.com/llvm/llvm-project/pull/72081
More information about the Mlir-commits
mailing list