From 0da1a6ceb595fa91e3af20bf7f304ba275526f3c Mon Sep 17 00:00:00 2001 From: Jeremy Kun Date: Mon, 20 May 2024 13:09:10 -0700 Subject: [PATCH] [mlir][polynomial] split polynomial types tablegen (#92805) Similar to https://github.com/llvm/llvm-project/pull/92613, but for types. Co-authored-by: Jeremy Kun --- .../mlir/Dialect/Polynomial/IR/Polynomial.td | 19 ++--------- .../Dialect/Polynomial/IR/PolynomialTypes.td | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 mlir/include/mlir/Dialect/Polynomial/IR/PolynomialTypes.td diff --git a/mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.td b/mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.td index 294f58ae084bfc7..3ef899d3376b132 100644 --- a/mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.td +++ b/mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.td @@ -1,4 +1,4 @@ -//===- PolynomialOps.td - Polynomial dialect ---------------*- tablegen -*-===// +//===- Polynomial.td - Polynomial dialect ------------------*- tablegen -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -15,22 +15,7 @@ include "mlir/Interfaces/InferTypeOpInterface.td" include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/Dialect/Polynomial/IR/PolynomialDialect.td" include "mlir/Dialect/Polynomial/IR/PolynomialAttributes.td" - -class Polynomial_Type - : TypeDef { - let mnemonic = typeMnemonic; -} - -def Polynomial_PolynomialType : Polynomial_Type<"Polynomial", "polynomial"> { - let summary = "An element of a polynomial ring."; - let description = [{ - A type for polynomials in a polynomial quotient ring. - }]; - let parameters = (ins Polynomial_RingAttr:$ring); - let assemblyFormat = "`<` struct(params) `>`"; -} - -def PolynomialLike: TypeOrContainer; +include "mlir/Dialect/Polynomial/IR/PolynomialTypes.td" class Polynomial_Op traits = []> : Op { diff --git a/mlir/include/mlir/Dialect/Polynomial/IR/PolynomialTypes.td b/mlir/include/mlir/Dialect/Polynomial/IR/PolynomialTypes.td new file mode 100644 index 000000000000000..89e406183e0b020 --- /dev/null +++ b/mlir/include/mlir/Dialect/Polynomial/IR/PolynomialTypes.td @@ -0,0 +1,32 @@ +//===- PolynomialTypes.td - Polynomial types ---------------*- 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_TYPES +#define POLYNOMIAL_TYPES + +include "mlir/Dialect/Polynomial/IR/PolynomialAttributes.td" +include "mlir/Dialect/Polynomial/IR/PolynomialDialect.td" + +class Polynomial_Type + : TypeDef { + let mnemonic = typeMnemonic; +} + +def Polynomial_PolynomialType : Polynomial_Type<"Polynomial", "polynomial"> { + let summary = "An element of a polynomial ring."; + let description = [{ + A type for polynomials in a polynomial quotient ring. + }]; + let parameters = (ins Polynomial_RingAttr:$ring); + let assemblyFormat = "`<` struct(params) `>`"; +} + +def PolynomialLike: TypeOrContainer; + + +#endif // POLYNOMIAL_TYPES