class RankedTensorType;
class UnrankedTensorType;
class TupleType;
+class NoneType;
class BoolAttr;
class IntegerAttr;
class FloatAttr;
RankedTensorType getTensorType(ArrayRef<int64_t> shape, Type elementType);
UnrankedTensorType getTensorType(Type elementType);
TupleType getTupleType(ArrayRef<Type> elementTypes);
+ NoneType getNoneType();
/// Get or construct an instance of the type 'ty' with provided arguments.
template <typename Ty, typename... Args> Ty getType(Args... args) {
MemRef,
Complex,
Tuple,
+ None,
};
} // namespace StandardTypes
static bool kindof(unsigned kind) { return kind == StandardTypes::Tuple; }
};
+/// NoneType is a unit type, i.e. a type with exactly one possible value, where
+/// its value does not have a defined dynamic representation.
+class NoneType : public Type::TypeBase<NoneType, Type> {
+public:
+ using Base::Base;
+
+ /// Get or create a NoneType instance.
+ static NoneType get(MLIRContext *context) {
+ return Base::get(context, StandardTypes::None);
+ }
+
+ static bool kindof(unsigned kind) { return kind == StandardTypes::None; }
+};
} // end namespace mlir
#endif // MLIR_IR_STANDARDTYPES_H
using namespace mlir;
using namespace mlir::detail;
-using namespace llvm;
+
+using llvm::hash_combine;
+using llvm::hash_combine_range;
/// A utility function to safely get or create a uniqued instance within the
/// given set container.
BuiltinDialect(MLIRContext *context) : Dialect(/*name=*/"", context) {
addTypes<FunctionType, OpaqueType, FloatType, IndexType, IntegerType,
VectorType, RankedTensorType, UnrankedTensorType, MemRefType,
- ComplexType, TupleType>();
+ ComplexType, TupleType, NoneType>();
}
};
/// This is a mapping from operation name to AbstractOperation for registered
/// operations.
- StringMap<AbstractOperation> registeredOperations;
+ llvm::StringMap<AbstractOperation> registeredOperations;
/// This is a mapping from type identifier to Dialect for registered types.
DenseMap<const TypeID *, Dialect *> registeredTypes;
BoolAttributeStorage *boolAttrs[2] = {nullptr};
DenseSet<IntegerAttributeStorage *, IntegerAttrKeyInfo> integerAttrs;
DenseSet<FloatAttributeStorage *, FloatAttrKeyInfo> floatAttrs;
- StringMap<StringAttributeStorage *> stringAttrs;
+ llvm::StringMap<StringAttributeStorage *> stringAttrs;
using ArrayAttrSet = DenseSet<ArrayAttributeStorage *, ArrayAttrKeyInfo>;
ArrayAttrSet arrayAttrs;
DenseMap<AffineMap, AffineMapAttributeStorage *> affineMapAttrs;
// We just have the operations in a non-deterministic hash table order. Dump
// into a temporary array, then sort it by operation name to get a stable
// ordering.
- StringMap<AbstractOperation> ®isteredOps =
+ llvm::StringMap<AbstractOperation> ®isteredOps =
getImpl().registeredOperations;
opsToSort.reserve(registeredOps.size());
Location FusedLoc::get(ArrayRef<Location> locs, Attribute metadata,
MLIRContext *context) {
// Unique the set of locations to be fused.
- SmallSetVector<Location, 4> decomposedLocs;
+ llvm::SmallSetVector<Location, 4> decomposedLocs;
for (auto loc : locs) {
// If the location is a fused location we decompose it if it has no
// metadata or the metadata is the same as the top level metadata.
/// | memref-type
/// | complex-type
/// | tuple-type
+/// | none-type
///
/// index-type ::= `index`
/// float-type ::= `f16` | `bf16` | `f32` | `f64`
+/// none-type ::= `none`
///
Type Parser::parseNonFunctionType() {
switch (getToken().getKind()) {
consumeToken(Token::kw_index);
return builder.getIndexType();
+ // none-type
+ case Token::kw_none:
+ consumeToken(Token::kw_none);
+ return builder.getNoneType();
+
// extended type
case Token::exclamation_identifier:
return parseExtendedType();