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

#ifdef GET_ATTRDEF_LIST
#undef GET_ATTRDEF_LIST

::mlir::mhlo::GatherDimensionNumbersAttr,
::mlir::mhlo::ScatterDimensionNumbersAttr

#endif  // GET_ATTRDEF_LIST

#ifdef GET_ATTRDEF_CLASSES
#undef GET_ATTRDEF_CLASSES


static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::MLIRContext *context,
                                      ::mlir::DialectAsmParser &parser,
                                      ::llvm::StringRef mnemonic, ::mlir::Type type,
                                      ::mlir::Attribute &value) {
  if (mnemonic == ::mlir::mhlo::GatherDimensionNumbersAttr::getMnemonic()) { 
    value = ::mlir::mhlo::GatherDimensionNumbersAttr::parse(context, parser, type);
    return ::mlir::success(!!value);
  }
  if (mnemonic == ::mlir::mhlo::ScatterDimensionNumbersAttr::getMnemonic()) { 
    value = ::mlir::mhlo::ScatterDimensionNumbersAttr::parse(context, parser, type);
    return ::mlir::success(!!value);
  }
  return {};
}


static ::mlir::LogicalResult generatedAttributePrinter(
                         ::mlir::Attribute def, ::mlir::DialectAsmPrinter &printer) {
  return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def)
    .Case<::mlir::mhlo::GatherDimensionNumbersAttr>([&](::mlir::mhlo::GatherDimensionNumbersAttr t) {
      t.print(printer);
      return ::mlir::success();
    })
    .Case<::mlir::mhlo::ScatterDimensionNumbersAttr>([&](::mlir::mhlo::ScatterDimensionNumbersAttr t) {
      t.print(printer);
      return ::mlir::success();
    })
    .Default([](::mlir::Attribute) { return ::mlir::failure(); });
}

namespace mlir {
namespace mhlo {

namespace detail {
  struct GatherDimensionNumbersAttrStorage : public ::mlir::AttributeStorage {
    GatherDimensionNumbersAttrStorage (::llvm::ArrayRef<int64_t> offsetDims, ::llvm::ArrayRef<int64_t> collapsedSliceDims, ::llvm::ArrayRef<int64_t> startIndexMap, int64_t indexVectorDim)
      : ::mlir::AttributeStorage(), offsetDims(offsetDims), collapsedSliceDims(collapsedSliceDims), startIndexMap(startIndexMap), indexVectorDim(indexVectorDim) { }

    /// The hash key is a tuple of the parameter types.
    using KeyTy = std::tuple<::llvm::ArrayRef<int64_t>, ::llvm::ArrayRef<int64_t>, ::llvm::ArrayRef<int64_t>, int64_t>;
  bool operator==(const KeyTy &tblgenKey) const {
    if (!(offsetDims == std::get<0>(tblgenKey)))
      return false;
    if (!(collapsedSliceDims == std::get<1>(tblgenKey)))
      return false;
    if (!(startIndexMap == std::get<2>(tblgenKey)))
      return false;
    if (!(indexVectorDim == std::get<3>(tblgenKey)))
      return false;
    return true;
  }
  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
      return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey));
    }

    /// Define a construction method for creating a new instance of this
    /// storage.
    static GatherDimensionNumbersAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator,
                          const KeyTy &tblgenKey) {
      auto offsetDims = std::get<0>(tblgenKey);
      auto collapsedSliceDims = std::get<1>(tblgenKey);
      auto startIndexMap = std::get<2>(tblgenKey);
      auto indexVectorDim = std::get<3>(tblgenKey);
      offsetDims = allocator.copyInto(offsetDims);
      collapsedSliceDims = allocator.copyInto(collapsedSliceDims);
      startIndexMap = allocator.copyInto(startIndexMap);

      return new (allocator.allocate<GatherDimensionNumbersAttrStorage>())
          GatherDimensionNumbersAttrStorage(offsetDims, collapsedSliceDims, startIndexMap, indexVectorDim);
    }
      ::llvm::ArrayRef<int64_t> offsetDims;
      ::llvm::ArrayRef<int64_t> collapsedSliceDims;
      ::llvm::ArrayRef<int64_t> startIndexMap;
      int64_t indexVectorDim;
  };
} // namespace detail
GatherDimensionNumbersAttr GatherDimensionNumbersAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<int64_t> offsetDims, ::llvm::ArrayRef<int64_t> collapsedSliceDims, ::llvm::ArrayRef<int64_t> startIndexMap, int64_t indexVectorDim) {
  return Base::get(context, offsetDims, collapsedSliceDims, startIndexMap, indexVectorDim);
}
::llvm::ArrayRef<int64_t> GatherDimensionNumbersAttr::getOffsetDims() const { return getImpl()->offsetDims; }
::llvm::ArrayRef<int64_t> GatherDimensionNumbersAttr::getCollapsedSliceDims() const { return getImpl()->collapsedSliceDims; }
::llvm::ArrayRef<int64_t> GatherDimensionNumbersAttr::getStartIndexMap() const { return getImpl()->startIndexMap; }
int64_t GatherDimensionNumbersAttr::getIndexVectorDim() const { return getImpl()->indexVectorDim; }
} // namespace mhlo
} // namespace mlir
DEFINE_EXPLICIT_TYPE_ID(::mlir::mhlo::GatherDimensionNumbersAttr)
namespace mlir {
namespace mhlo {

namespace detail {
  struct ScatterDimensionNumbersAttrStorage : public ::mlir::AttributeStorage {
    ScatterDimensionNumbersAttrStorage (::llvm::ArrayRef<int64_t> updateWindowDims, ::llvm::ArrayRef<int64_t> insertedWindowDims, ::llvm::ArrayRef<int64_t> scatterDimsToOperandDims, int64_t indexVectorDim)
      : ::mlir::AttributeStorage(), updateWindowDims(updateWindowDims), insertedWindowDims(insertedWindowDims), scatterDimsToOperandDims(scatterDimsToOperandDims), indexVectorDim(indexVectorDim) { }

    /// The hash key is a tuple of the parameter types.
    using KeyTy = std::tuple<::llvm::ArrayRef<int64_t>, ::llvm::ArrayRef<int64_t>, ::llvm::ArrayRef<int64_t>, int64_t>;
  bool operator==(const KeyTy &tblgenKey) const {
    if (!(updateWindowDims == std::get<0>(tblgenKey)))
      return false;
    if (!(insertedWindowDims == std::get<1>(tblgenKey)))
      return false;
    if (!(scatterDimsToOperandDims == std::get<2>(tblgenKey)))
      return false;
    if (!(indexVectorDim == std::get<3>(tblgenKey)))
      return false;
    return true;
  }
  static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
      return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey));
    }

    /// Define a construction method for creating a new instance of this
    /// storage.
    static ScatterDimensionNumbersAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator,
                          const KeyTy &tblgenKey) {
      auto updateWindowDims = std::get<0>(tblgenKey);
      auto insertedWindowDims = std::get<1>(tblgenKey);
      auto scatterDimsToOperandDims = std::get<2>(tblgenKey);
      auto indexVectorDim = std::get<3>(tblgenKey);
      updateWindowDims = allocator.copyInto(updateWindowDims);
      insertedWindowDims = allocator.copyInto(insertedWindowDims);
      scatterDimsToOperandDims = allocator.copyInto(scatterDimsToOperandDims);

      return new (allocator.allocate<ScatterDimensionNumbersAttrStorage>())
          ScatterDimensionNumbersAttrStorage(updateWindowDims, insertedWindowDims, scatterDimsToOperandDims, indexVectorDim);
    }
      ::llvm::ArrayRef<int64_t> updateWindowDims;
      ::llvm::ArrayRef<int64_t> insertedWindowDims;
      ::llvm::ArrayRef<int64_t> scatterDimsToOperandDims;
      int64_t indexVectorDim;
  };
} // namespace detail
ScatterDimensionNumbersAttr ScatterDimensionNumbersAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<int64_t> updateWindowDims, ::llvm::ArrayRef<int64_t> insertedWindowDims, ::llvm::ArrayRef<int64_t> scatterDimsToOperandDims, int64_t indexVectorDim) {
  return Base::get(context, updateWindowDims, insertedWindowDims, scatterDimsToOperandDims, indexVectorDim);
}
::llvm::ArrayRef<int64_t> ScatterDimensionNumbersAttr::getUpdateWindowDims() const { return getImpl()->updateWindowDims; }
::llvm::ArrayRef<int64_t> ScatterDimensionNumbersAttr::getInsertedWindowDims() const { return getImpl()->insertedWindowDims; }
::llvm::ArrayRef<int64_t> ScatterDimensionNumbersAttr::getScatterDimsToOperandDims() const { return getImpl()->scatterDimsToOperandDims; }
int64_t ScatterDimensionNumbersAttr::getIndexVectorDim() const { return getImpl()->indexVectorDim; }
} // namespace mhlo
} // namespace mlir
DEFINE_EXPLICIT_TYPE_ID(::mlir::mhlo::ScatterDimensionNumbersAttr)

#endif  // GET_ATTRDEF_CLASSES

