/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|*                                                                            *|
|* TypeDef Definitions                                                        *|
|*                                                                            *|
|* Automatically generated file, do not edit!                                 *|
|*                                                                            *|
\*===----------------------------------------------------------------------===*/

#ifdef GET_TYPEDEF_LIST
#undef GET_TYPEDEF_LIST

::mlir::arm_sve::ScalableVectorType

#endif  // GET_TYPEDEF_LIST

#ifdef GET_TYPEDEF_CLASSES
#undef GET_TYPEDEF_CLASSES

static ::mlir::Type generatedTypeParser(::mlir::MLIRContext *context, ::mlir::DialectAsmParser &parser, ::llvm::StringRef mnemonic) {
  if (mnemonic == ::mlir::arm_sve::ScalableVectorType::getMnemonic()) return ::mlir::arm_sve::ScalableVectorType::parse(context, parser);
  return ::mlir::Type();
}

static ::mlir::LogicalResult generatedTypePrinter(::mlir::Type type, ::mlir::DialectAsmPrinter &printer) {
  return ::llvm::TypeSwitch<::mlir::Type, ::mlir::LogicalResult>(type)
    .Case<::mlir::arm_sve::ScalableVectorType>([&](::mlir::arm_sve::ScalableVectorType t) {
      t.print(printer);
      return ::mlir::success();
    })
    .Default([](::mlir::Type) { return ::mlir::failure(); });
}

namespace mlir {
namespace arm_sve {

namespace detail {
  struct ScalableVectorTypeStorage : public ::mlir::TypeStorage {
    ScalableVectorTypeStorage (::llvm::ArrayRef<int64_t> shape, Type elementType)
      : shape(shape), elementType(elementType) { }

    /// The hash key for this storage is a pair of the integer and type params.
    using KeyTy = std::tuple<::llvm::ArrayRef<int64_t>, Type>;

    /// Define the comparison function for the key type.
    bool operator==(const KeyTy &key) const {
      return key == KeyTy(shape, elementType);
    }
  static ::llvm::hash_code hashKey(const KeyTy &key) {
      const auto &shape = std::get<0>(key);
      const auto &elementType = std::get<1>(key);
      return ::llvm::hash_combine(shape, elementType);
    }

    /// Define a construction method for creating a new instance of this storage.
    static ScalableVectorTypeStorage *construct(::mlir::TypeStorageAllocator &allocator, const KeyTy &key) {
      auto shape = std::get<0>(key);
      auto elementType = std::get<1>(key);
      shape = allocator.copyInto(shape);

      return new (allocator.allocate<ScalableVectorTypeStorage>())
          ScalableVectorTypeStorage(shape, elementType);
    }
      ::llvm::ArrayRef<int64_t> shape;
      Type elementType;
  };
} // namespace detail
ScalableVectorType ScalableVectorType::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<int64_t> shape, Type elementType) {
  return Base::get(context, shape, elementType);
}
::llvm::ArrayRef<int64_t> ScalableVectorType::getShape() const { return getImpl()->shape; }
Type ScalableVectorType::getElementType() const { return getImpl()->elementType; }
void ScalableVectorType::print(::mlir::DialectAsmPrinter &printer) const {

    printer << "vector<";
    for (int64_t dim : getShape())
      printer << dim << 'x';
    printer << getElementType() << '>';
  
}
::mlir::Type ScalableVectorType::parse(::mlir::MLIRContext *context, ::mlir::DialectAsmParser &parser) {

    VectorType vector;
    if (parser.parseType(vector))
      return Type();
    return get(context, vector.getShape(), vector.getElementType());
  
}
} // namespace arm_sve
} // namespace mlir

#endif  // GET_TYPEDEF_CLASSES

