@@ -18,7 +18,7 @@ class Polynomial_Attr<string name, string attrMnemonic, list<Trait> traits = []>
18
18
}
19
19
20
20
def Polynomial_IntPolynomialAttr : Polynomial_Attr<"IntPolynomial", "int_polynomial"> {
21
- let summary = "An attribute containing a single-variable polynomial with integer coefficients. ";
21
+ let summary = "an attribute containing a single-variable polynomial with integer coefficients";
22
22
let description = [{
23
23
A polynomial attribute represents a single-variable polynomial with integer
24
24
coefficients, which is used to define the modulus of a `RingAttr`, as well
@@ -41,7 +41,7 @@ def Polynomial_IntPolynomialAttr : Polynomial_Attr<"IntPolynomial", "int_polynom
41
41
}
42
42
43
43
def Polynomial_FloatPolynomialAttr : Polynomial_Attr<"FloatPolynomial", "float_polynomial"> {
44
- let summary = "An attribute containing a single-variable polynomial with double precision floating point coefficients. ";
44
+ let summary = "an attribute containing a single-variable polynomial with double precision floating point coefficients";
45
45
let description = [{
46
46
A polynomial attribute represents a single-variable polynomial with double
47
47
precision floating point coefficients.
@@ -62,8 +62,56 @@ def Polynomial_FloatPolynomialAttr : Polynomial_Attr<"FloatPolynomial", "float_p
62
62
let hasCustomAssemblyFormat = 1;
63
63
}
64
64
65
+ def Polynomial_TypedIntPolynomialAttr : Polynomial_Attr<
66
+ "TypedIntPolynomial", "typed_int_polynomial", [TypedAttrInterface]> {
67
+ let summary = "a typed int_polynomial";
68
+ let parameters = (ins "::mlir::Type":$type, "::mlir::polynomial::IntPolynomialAttr":$value);
69
+ let assemblyFormat = "$value `:` $type";
70
+ let builders = [
71
+ AttrBuilderWithInferredContext<(ins "Type":$type,
72
+ "const IntPolynomial &":$value), [{
73
+ return $_get(
74
+ type.getContext(),
75
+ type,
76
+ IntPolynomialAttr::get(type.getContext(), value));
77
+ }]>,
78
+ AttrBuilderWithInferredContext<(ins "Type":$type,
79
+ "const Attribute &":$value), [{
80
+ return $_get(type.getContext(), type, ::llvm::cast<IntPolynomialAttr>(value));
81
+ }]>
82
+ ];
83
+ let extraClassDeclaration = [{
84
+ // used for constFoldBinaryOp
85
+ using ValueType = ::mlir::Attribute;
86
+ }];
87
+ }
88
+
89
+ def Polynomial_TypedFloatPolynomialAttr : Polynomial_Attr<
90
+ "TypedFloatPolynomial", "typed_float_polynomial", [TypedAttrInterface]> {
91
+ let summary = "a typed float_polynomial";
92
+ let parameters = (ins "::mlir::Type":$type, "::mlir::polynomial::FloatPolynomialAttr":$value);
93
+ let assemblyFormat = "$value `:` $type";
94
+ let builders = [
95
+ AttrBuilderWithInferredContext<(ins "Type":$type,
96
+ "const FloatPolynomial &":$value), [{
97
+ return $_get(
98
+ type.getContext(),
99
+ type,
100
+ FloatPolynomialAttr::get(type.getContext(), value));
101
+ }]>,
102
+ AttrBuilderWithInferredContext<(ins "Type":$type,
103
+ "const Attribute &":$value), [{
104
+ return $_get(type.getContext(), type, ::llvm::cast<FloatPolynomialAttr>(value));
105
+ }]>
106
+ ];
107
+ let extraClassDeclaration = [{
108
+ // used for constFoldBinaryOp
109
+ using ValueType = ::mlir::Attribute;
110
+ }];
111
+ }
112
+
65
113
def Polynomial_RingAttr : Polynomial_Attr<"Ring", "ring"> {
66
- let summary = "An attribute specifying a polynomial ring. ";
114
+ let summary = "an attribute specifying a polynomial ring";
67
115
let description = [{
68
116
A ring describes the domain in which polynomial arithmetic occurs. The ring
69
117
attribute in `polynomial` represents the more specific case of polynomials
0 commit comments