llvm/mlir/lib/Tools/PDLL/AST/TypeDetail.h

//===- TypeDetail.h ---------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LIB_MLIR_TOOLS_PDLL_AST_TYPEDETAIL_H_
#define LIB_MLIR_TOOLS_PDLL_AST_TYPEDETAIL_H_

#include "mlir/Tools/PDLL/AST/Types.h"

namespace mlir {
namespace pdll {
namespace ast {
//===----------------------------------------------------------------------===//
// Type
//===----------------------------------------------------------------------===//

struct Type::Storage : public StorageUniquer::BaseStorage {};

namespace detail {

/// A utility CRTP base class that defines many of the necessary utilities for
/// defining a PDLL AST Type.
template <typename ConcreteT, typename KeyT = void>
struct TypeStorageBase : public Type::Storage {};
/// A specialization of the storage base for singleton types.
TypeStorageBase<ConcreteT, void>;

//===----------------------------------------------------------------------===//
// AttributeType
//===----------------------------------------------------------------------===//

struct AttributeTypeStorage : public TypeStorageBase<AttributeTypeStorage> {};

//===----------------------------------------------------------------------===//
// ConstraintType
//===----------------------------------------------------------------------===//

struct ConstraintTypeStorage : public TypeStorageBase<ConstraintTypeStorage> {};

//===----------------------------------------------------------------------===//
// OperationType
//===----------------------------------------------------------------------===//

struct OperationTypeStorage
    : public TypeStorageBase<OperationTypeStorage,
                             std::pair<StringRef, const ods::Operation *>> {};

//===----------------------------------------------------------------------===//
// RangeType
//===----------------------------------------------------------------------===//

struct RangeTypeStorage : public TypeStorageBase<RangeTypeStorage, Type> {};

//===----------------------------------------------------------------------===//
// RewriteType
//===----------------------------------------------------------------------===//

struct RewriteTypeStorage : public TypeStorageBase<RewriteTypeStorage> {};

//===----------------------------------------------------------------------===//
// TupleType
//===----------------------------------------------------------------------===//

struct TupleTypeStorage
    : public TypeStorageBase<TupleTypeStorage,
                             std::pair<ArrayRef<Type>, ArrayRef<StringRef>>> {};

//===----------------------------------------------------------------------===//
// TypeType
//===----------------------------------------------------------------------===//

struct TypeTypeStorage : public TypeStorageBase<TypeTypeStorage> {};

//===----------------------------------------------------------------------===//
// ValueType
//===----------------------------------------------------------------------===//

struct ValueTypeStorage : public TypeStorageBase<ValueTypeStorage> {};

} // namespace detail
} // namespace ast
} // namespace pdll
} // namespace mlir

#endif // LIB_MLIR_TOOLS_PDLL_AST_TYPEDETAIL_H_