// A constraint on types. This can be used to check the validity of
// instruction arguments.
-class TypeConstraint<Pred condition, string descr = ""> {
+class TypeConstraint<Pred condition, string descr> {
// The predicates that this type satisfies.
// Format: {0} will be expanded to the type.
Pred predicate = condition;
- // User-readable description used, e.g., for error reporting. If empty, a
- // generic message will be used instead.
+ // User-readable description used, e.g., for error reporting. If empty,
+ // a generic message will be used instead.
string description = descr;
}
// A type, carries type constraints, but accepts any type by default.
-class Type<Pred condition = CPred<"true">, string descr = "">
+class Type<Pred condition, string descr = "">
: TypeConstraint<condition, descr>;
// A type that can be constructed using MLIR::Builder.
}
// Integer types.
-class IntegerBase<CPred pred, string descr = ?> : Type<pred, descr>;
+class IntegerBase<CPred pred, string descr> : Type<pred, descr>;
// Any integer type irrespective of its width.
def Integer : IntegerBase<CPred<"{0}.isa<IntegerType>()">, "integer">;
// Integer type of a specific width.
class I<int width>
- : IntegerBase<CPred<"{0}.isInteger(" # width # ")">, "i" # width>,
+ : IntegerBase<CPred<"{0}.isInteger(" # width # ")">,
+ width # "-bit integer">,
BuildableType<"getIntegerType(" # width # ")"> {
int bitwidth = width;
}
def I32 : I<32>;
// Floating point types.
-class FloatBase<CPred pred, string descr = ?> : Type<pred, descr>;
+class FloatBase<CPred pred, string descr> : Type<pred, descr>;
// Any float type irrespective of its width.
-def Float : FloatBase<CPred<"{0}.isa<FloatType>()">, "floating point">;
+def Float : FloatBase<CPred<"{0}.isa<FloatType>()">, "floating-point">;
// Float type of a specific width.
class F<int width>
- : FloatBase<CPred<"{0}.isF" # width # "()">, "f" # width>,
+ : FloatBase<CPred<"{0}.isF" # width # "()">,
+ width # "-bit float">,
BuildableType<"getF" # width # "Type()"> {
int bitwidth = width;
}
// element into the element type checker.
Type<AllOf<[containerPred,
SubstLeaves<"{0}", !cast<string>(elementTypeCall),
- etype.predicate>]>,
- descr # "<" # etype.description # ">" > {
+ etype.predicate>]>,
+ descr # " of " # etype.description # " values"> {
// The type of elements in the container.
Type elementType = etype;
class TypedTensor<Type t>
: ContainerType<t, Tensor.predicate,
"{0}.cast<TensorType>().getElementType()",
- "tensor">;
+ "tensor">;
def F32Tensor : TypedTensor<F32>;
// Type constraint for float-like types: floats, vectors or tensors thereof.
def FloatLike : TypeConstraint<AnyOf<[Float.predicate,
TypedVector<Float>.predicate, TypedTensor<Float>.predicate]>,
- "float-like">;
+ "floating-point-like">;
//===----------------------------------------------------------------------===//
// Attributes