/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|*                                                                            *|
|* Enum Utility Definitions                                                   *|
|*                                                                            *|
|* Automatically generated file, do not edit!                                 *|
|* From: SMT.td                                                               *|
|*                                                                            *|
\*===----------------------------------------------------------------------===*/

namespace mlir {
namespace smt {
::llvm::StringRef stringifyBVCmpPredicate(BVCmpPredicate val) {
  switch (val) {
    case BVCmpPredicate::slt: return "slt";
    case BVCmpPredicate::sle: return "sle";
    case BVCmpPredicate::sgt: return "sgt";
    case BVCmpPredicate::sge: return "sge";
    case BVCmpPredicate::ult: return "ult";
    case BVCmpPredicate::ule: return "ule";
    case BVCmpPredicate::ugt: return "ugt";
    case BVCmpPredicate::uge: return "uge";
  }
  return "";
}

::std::optional<BVCmpPredicate> symbolizeBVCmpPredicate(::llvm::StringRef str) {
  return ::llvm::StringSwitch<::std::optional<BVCmpPredicate>>(str)
      .Case("slt", BVCmpPredicate::slt)
      .Case("sle", BVCmpPredicate::sle)
      .Case("sgt", BVCmpPredicate::sgt)
      .Case("sge", BVCmpPredicate::sge)
      .Case("ult", BVCmpPredicate::ult)
      .Case("ule", BVCmpPredicate::ule)
      .Case("ugt", BVCmpPredicate::ugt)
      .Case("uge", BVCmpPredicate::uge)
      .Default(::std::nullopt);
}
::std::optional<BVCmpPredicate> symbolizeBVCmpPredicate(uint64_t value) {
  switch (value) {
  case 0: return BVCmpPredicate::slt;
  case 1: return BVCmpPredicate::sle;
  case 2: return BVCmpPredicate::sgt;
  case 3: return BVCmpPredicate::sge;
  case 4: return BVCmpPredicate::ult;
  case 5: return BVCmpPredicate::ule;
  case 6: return BVCmpPredicate::ugt;
  case 7: return BVCmpPredicate::uge;
  default: return ::std::nullopt;
  }
}

bool BVCmpPredicateAttr::classof(::mlir::Attribute attr) {
  return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 0)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 1)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 2)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 3)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 4)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 5)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 6)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 7)))));
}
BVCmpPredicateAttr BVCmpPredicateAttr::get(::mlir::MLIRContext *context, BVCmpPredicate val) {
  ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64);
  ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast<uint64_t>(val));
  return ::llvm::cast<BVCmpPredicateAttr>(baseAttr);
}
BVCmpPredicate BVCmpPredicateAttr::getValue() const {
  return static_cast<BVCmpPredicate>(::mlir::IntegerAttr::getValue().getZExtValue());
}
} // namespace smt
} // namespace mlir

namespace mlir {
namespace smt {
::llvm::StringRef stringifyIntPredicate(IntPredicate val) {
  switch (val) {
    case IntPredicate::lt: return "lt";
    case IntPredicate::le: return "le";
    case IntPredicate::gt: return "gt";
    case IntPredicate::ge: return "ge";
  }
  return "";
}

::std::optional<IntPredicate> symbolizeIntPredicate(::llvm::StringRef str) {
  return ::llvm::StringSwitch<::std::optional<IntPredicate>>(str)
      .Case("lt", IntPredicate::lt)
      .Case("le", IntPredicate::le)
      .Case("gt", IntPredicate::gt)
      .Case("ge", IntPredicate::ge)
      .Default(::std::nullopt);
}
::std::optional<IntPredicate> symbolizeIntPredicate(uint64_t value) {
  switch (value) {
  case 0: return IntPredicate::lt;
  case 1: return IntPredicate::le;
  case 2: return IntPredicate::gt;
  case 3: return IntPredicate::ge;
  default: return ::std::nullopt;
  }
}

bool IntPredicateAttr::classof(::mlir::Attribute attr) {
  return (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(64)))) && (((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 0)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 1)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 2)))) || ((
    ::llvm::cast<::mlir::IntegerAttr>(attr).getValue().eq(::llvm::APInt(64, 3)))));
}
IntPredicateAttr IntPredicateAttr::get(::mlir::MLIRContext *context, IntPredicate val) {
  ::mlir::IntegerType intType = ::mlir::IntegerType::get(context, 64);
  ::mlir::IntegerAttr baseAttr = ::mlir::IntegerAttr::get(intType, static_cast<uint64_t>(val));
  return ::llvm::cast<IntPredicateAttr>(baseAttr);
}
IntPredicate IntPredicateAttr::getValue() const {
  return static_cast<IntPredicate>(::mlir::IntegerAttr::getValue().getZExtValue());
}
} // namespace smt
} // namespace mlir

