/
PolynomialTypes.td
47 lines (37 loc) · 1.46 KB
/
PolynomialTypes.td
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef INCLUDE_DIALECT_POLYNOMIAL_IR_POLYNOMIALTYPES_TD_
#define INCLUDE_DIALECT_POLYNOMIAL_IR_POLYNOMIALTYPES_TD_
include "include/Dialect/Polynomial/IR/PolynomialDialect.td"
include "include/Dialect/Polynomial/IR/PolynomialAttributes.td"
include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/BuiltinTypes.td"
include "mlir/IR/DialectBase.td"
// A base class for all types in this dialect
class Polynomial_Type<string name, string typeMnemonic, list<Trait> traits = []>
: TypeDef<Polynomial_Dialect, name, traits> {
let mnemonic = typeMnemonic;
}
def Polynomial : Polynomial_Type<"Polynomial", "polynomial"> {
let summary = "An element of a polynomial quotient ring";
let description = [{
A type for polynomials in a polynomial quotient ring.
}];
let parameters = (ins
Ring_Attr:$ring,
OptionalParameter<"Attribute">:$encoding
);
// TODO(#181): Skip the default builder since the custom builder enables the
// default value for the encoding parameter, And I couldn't get
// DefaultValueParameter to auto-generate a builder with the appropriate default
// value.
let skipDefaultBuilders = 1;
let builders = [
TypeBuilder<(ins
"RingAttr":$ring, CArg<"Attribute", "{}">:$encoding
), [{
return $_get($_ctxt, ring, encoding);
}]>
];
let assemblyFormat = "`<` $ring (`,` $encoding^ )? `>`";
}
def PolynomialLike: TypeOrContainer<Polynomial, "polynomial-like">;
#endif // INCLUDE_DIALECT_POLYNOMIAL_IR_POLYNOMIALTYPES_TD_