Skip to content

Commit 0da1a6c

Browse files
authored
[mlir][polynomial] split polynomial types tablegen (llvm#92805)
Similar to llvm#92613, but for types. Co-authored-by: Jeremy Kun <[email protected]>
1 parent c1d5cc9 commit 0da1a6c

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.td

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- PolynomialOps.td - Polynomial dialect ---------------*- tablegen -*-===//
1+
//===- Polynomial.td - Polynomial dialect ------------------*- tablegen -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -15,22 +15,7 @@ include "mlir/Interfaces/InferTypeOpInterface.td"
1515
include "mlir/Interfaces/SideEffectInterfaces.td"
1616
include "mlir/Dialect/Polynomial/IR/PolynomialDialect.td"
1717
include "mlir/Dialect/Polynomial/IR/PolynomialAttributes.td"
18-
19-
class Polynomial_Type<string name, string typeMnemonic>
20-
: TypeDef<Polynomial_Dialect, name> {
21-
let mnemonic = typeMnemonic;
22-
}
23-
24-
def Polynomial_PolynomialType : Polynomial_Type<"Polynomial", "polynomial"> {
25-
let summary = "An element of a polynomial ring.";
26-
let description = [{
27-
A type for polynomials in a polynomial quotient ring.
28-
}];
29-
let parameters = (ins Polynomial_RingAttr:$ring);
30-
let assemblyFormat = "`<` struct(params) `>`";
31-
}
32-
33-
def PolynomialLike: TypeOrContainer<Polynomial_PolynomialType, "polynomial-like">;
18+
include "mlir/Dialect/Polynomial/IR/PolynomialTypes.td"
3419

3520
class Polynomial_Op<string mnemonic, list<Trait> traits = []> :
3621
Op<Polynomial_Dialect, mnemonic, traits # [Pure]> {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//===- PolynomialTypes.td - Polynomial types ---------------*- tablegen -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef POLYNOMIAL_TYPES
10+
#define POLYNOMIAL_TYPES
11+
12+
include "mlir/Dialect/Polynomial/IR/PolynomialAttributes.td"
13+
include "mlir/Dialect/Polynomial/IR/PolynomialDialect.td"
14+
15+
class Polynomial_Type<string name, string typeMnemonic>
16+
: TypeDef<Polynomial_Dialect, name> {
17+
let mnemonic = typeMnemonic;
18+
}
19+
20+
def Polynomial_PolynomialType : Polynomial_Type<"Polynomial", "polynomial"> {
21+
let summary = "An element of a polynomial ring.";
22+
let description = [{
23+
A type for polynomials in a polynomial quotient ring.
24+
}];
25+
let parameters = (ins Polynomial_RingAttr:$ring);
26+
let assemblyFormat = "`<` struct(params) `>`";
27+
}
28+
29+
def PolynomialLike: TypeOrContainer<Polynomial_PolynomialType, "polynomial-like">;
30+
31+
32+
#endif // POLYNOMIAL_TYPES

0 commit comments

Comments
 (0)