[Mlir-commits] [mlir] Add a polynomial dialect shell, attributes, and types (PR #72081)
Jeremy Kun
llvmlistbot at llvm.org
Mon Nov 13 10:20:14 PST 2023
================
@@ -0,0 +1,65 @@
+//===- Polynomial.h - Storage class details for polynomial types --------*-
+// C++-*-==//
+//
+// 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 INCLUDE_MLIR_DIALECT_POLYNOMIAL_IR_POLYNOMIALDETAIL_H_
+#define INCLUDE_MLIR_DIALECT_POLYNOMIAL_IR_POLYNOMIALDETAIL_H_
+
+#include "mlir/Dialect/Polynomial/IR/Polynomial.h"
+#include "mlir/Support/StorageUniquer.h"
+#include "mlir/Support/TypeID.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/TrailingObjects.h"
+
+namespace mlir {
+namespace polynomial {
+namespace detail {
+
+// A Polynomial is stored as an ordered list of monomial terms, each of which
+// is a tuple of coefficient and exponent.
+struct PolynomialStorage final
+ : public StorageUniquer::BaseStorage,
+ public llvm::TrailingObjects<PolynomialStorage, Monomial> {
+ /// The hash key used for uniquing.
+ using KeyTy = std::tuple<unsigned, ArrayRef<Monomial>>;
+
+ unsigned numTerms;
+
+ MLIRContext *context;
----------------
j2kun wrote:
This is used by the `Polynomial` class as its source of truth for a context. As I understand, nothing outside the impl should be stored on the `Polynomial` class...
https://github.com/llvm/llvm-project/pull/72081
More information about the Mlir-commits
mailing list