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

namespace mlir {

/// Interface for types that can be used as storage types in Quant dialect.
/// This interface provides methods to determine storage characteristics for quantization purposes,
/// including packing behavior, and alignment requirements.
class QuantStorageTypeInterface;

} // namespace mlir
namespace mlir {

/// Interface for types that can be used as storage types in Quant dialect.
/// This interface provides methods to determine storage characteristics for quantization purposes,
/// including packing behavior, and alignment requirements.
namespace detail {
struct QuantStorageTypeInterfaceInterfaceTraits {
  struct Concept {
    /// The methods defined by the interface.
    bool (*shouldDefaultToSigned)(const Concept *impl, ::mlir::Type );
    unsigned (*getStorageWidth)(const Concept *impl, ::mlir::Type );
    int64_t (*getDefaultMinimum)(const Concept *impl, ::mlir::Type , bool);
    int64_t (*getDefaultMaximum)(const Concept *impl, ::mlir::Type , bool);
    std::string (*getStorageTypeName)(const Concept *impl, ::mlir::Type , bool);
    bool (*isPacked)(const Concept *impl, ::mlir::Type );
    unsigned (*getLogicalBitWidth)(const Concept *impl, ::mlir::Type );
    unsigned (*getElementsPerByte)(const Concept *impl, ::mlir::Type );
    std::optional<unsigned> (*getPreferredAlignmentBytes)(const Concept *impl, ::mlir::Type );
  };
  template<typename ConcreteType>
  class Model : public Concept {
  public:
    using Interface = ::mlir::QuantStorageTypeInterface;
    Model() : Concept{shouldDefaultToSigned, getStorageWidth, getDefaultMinimum, getDefaultMaximum, getStorageTypeName, isPacked, getLogicalBitWidth, getElementsPerByte, getPreferredAlignmentBytes} {}

    static inline bool shouldDefaultToSigned(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline unsigned getStorageWidth(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline int64_t getDefaultMinimum(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned);
    static inline int64_t getDefaultMaximum(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned);
    static inline std::string getStorageTypeName(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned);
    static inline bool isPacked(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline unsigned getLogicalBitWidth(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline unsigned getElementsPerByte(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline std::optional<unsigned> getPreferredAlignmentBytes(const Concept *impl, ::mlir::Type tablegen_opaque_val);
  };
  template<typename ConcreteType>
  class FallbackModel : public Concept {
  public:
    using Interface = ::mlir::QuantStorageTypeInterface;
    FallbackModel() : Concept{shouldDefaultToSigned, getStorageWidth, getDefaultMinimum, getDefaultMaximum, getStorageTypeName, isPacked, getLogicalBitWidth, getElementsPerByte, getPreferredAlignmentBytes} {}

    static inline bool shouldDefaultToSigned(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline unsigned getStorageWidth(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline int64_t getDefaultMinimum(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned);
    static inline int64_t getDefaultMaximum(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned);
    static inline std::string getStorageTypeName(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned);
    static inline bool isPacked(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline unsigned getLogicalBitWidth(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline unsigned getElementsPerByte(const Concept *impl, ::mlir::Type tablegen_opaque_val);
    static inline std::optional<unsigned> getPreferredAlignmentBytes(const Concept *impl, ::mlir::Type tablegen_opaque_val);
  };
  template<typename ConcreteModel, typename ConcreteType>
  class ExternalModel : public FallbackModel<ConcreteModel> {
  public:
    using ConcreteEntity = ConcreteType;
  };
};
template <typename ConcreteType>
struct QuantStorageTypeInterfaceTrait;

} // namespace detail
class QuantStorageTypeInterface : public ::mlir::TypeInterface<QuantStorageTypeInterface, detail::QuantStorageTypeInterfaceInterfaceTraits> {
public:
  using ::mlir::TypeInterface<QuantStorageTypeInterface, detail::QuantStorageTypeInterfaceInterfaceTraits>::TypeInterface;
  template <typename ConcreteType>
  struct Trait : public detail::QuantStorageTypeInterfaceTrait<ConcreteType> {};

  /// Whether the storage type should default to signed when used in quantization.
  /// Returns true if the type defaults to signed (e.g., si8, i8 or float types),
  /// false if it defaults to unsigned.
  bool shouldDefaultToSigned() const;

  /// Get the bit width of this type.
  /// Returns the number of bits used to store values of this type.
  unsigned getStorageWidth() const;

  /// Get default minimum value for this type.
  int64_t getDefaultMinimum(bool isSigned) const;

  /// Get default maximum value for this type.
  int64_t getDefaultMaximum(bool isSigned) const;

  /// Get the storage type as a string.
  std::string getStorageTypeName(bool isSigned) const;

  /// Check if the storage type uses packed representation.
  /// Returns true if multiple values are packed into one byte (e.g., sub-byte types),
  /// false if value uses full byte.
  bool isPacked() const;

  /// Get the logical bit width per value.
  /// For packed sub-byte types, this may differ from getStorageWidth().
  unsigned getLogicalBitWidth() const;

  /// Get the number of logical elements that fit in one byte.
  /// For packed sub-byte types, this returns how many values can be stored per byte.
  unsigned getElementsPerByte() const;

  /// Returns the preferred alignment for this type, in bytes.
  std::optional<unsigned> getPreferredAlignmentBytes() const;
};

} // namespace mlir
namespace mlir::detail {

  template <typename ConcreteType>
  struct QuantStorageTypeInterfaceTrait : public ::mlir::TypeInterface<QuantStorageTypeInterface, detail::QuantStorageTypeInterfaceInterfaceTraits>::Trait<ConcreteType> {
  };

} // namespace mlir::detail
namespace mlir {

template<typename ConcreteType>
bool detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::shouldDefaultToSigned(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).shouldDefaultToSigned();
}
template<typename ConcreteType>
unsigned detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::getStorageWidth(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).getStorageWidth();
}
template<typename ConcreteType>
int64_t detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::getDefaultMinimum(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).getDefaultMinimum(isSigned);
}
template<typename ConcreteType>
int64_t detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::getDefaultMaximum(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).getDefaultMaximum(isSigned);
}
template<typename ConcreteType>
std::string detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::getStorageTypeName(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).getStorageTypeName(isSigned);
}
template<typename ConcreteType>
bool detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::isPacked(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).isPacked();
}
template<typename ConcreteType>
unsigned detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::getLogicalBitWidth(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).getLogicalBitWidth();
}
template<typename ConcreteType>
unsigned detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::getElementsPerByte(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).getElementsPerByte();
}
template<typename ConcreteType>
std::optional<unsigned> detail::QuantStorageTypeInterfaceInterfaceTraits::Model<ConcreteType>::getPreferredAlignmentBytes(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return (::llvm::cast<ConcreteType>(tablegen_opaque_val)).getPreferredAlignmentBytes();
}
template<typename ConcreteType>
bool detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::shouldDefaultToSigned(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return static_cast<const ConcreteType *>(impl)->shouldDefaultToSigned(tablegen_opaque_val);
}
template<typename ConcreteType>
unsigned detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::getStorageWidth(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return static_cast<const ConcreteType *>(impl)->getStorageWidth(tablegen_opaque_val);
}
template<typename ConcreteType>
int64_t detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::getDefaultMinimum(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned) {
  return static_cast<const ConcreteType *>(impl)->getDefaultMinimum(tablegen_opaque_val, isSigned);
}
template<typename ConcreteType>
int64_t detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::getDefaultMaximum(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned) {
  return static_cast<const ConcreteType *>(impl)->getDefaultMaximum(tablegen_opaque_val, isSigned);
}
template<typename ConcreteType>
std::string detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::getStorageTypeName(const Concept *impl, ::mlir::Type tablegen_opaque_val, bool isSigned) {
  return static_cast<const ConcreteType *>(impl)->getStorageTypeName(tablegen_opaque_val, isSigned);
}
template<typename ConcreteType>
bool detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::isPacked(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return static_cast<const ConcreteType *>(impl)->isPacked(tablegen_opaque_val);
}
template<typename ConcreteType>
unsigned detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::getLogicalBitWidth(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return static_cast<const ConcreteType *>(impl)->getLogicalBitWidth(tablegen_opaque_val);
}
template<typename ConcreteType>
unsigned detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::getElementsPerByte(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return static_cast<const ConcreteType *>(impl)->getElementsPerByte(tablegen_opaque_val);
}
template<typename ConcreteType>
std::optional<unsigned> detail::QuantStorageTypeInterfaceInterfaceTraits::FallbackModel<ConcreteType>::getPreferredAlignmentBytes(const Concept *impl, ::mlir::Type tablegen_opaque_val) {
  return static_cast<const ConcreteType *>(impl)->getPreferredAlignmentBytes(tablegen_opaque_val);
}

} // namespace mlir
