22using namespace nanobind::literals;
43 nb::arg(
"context").none() = nb::none());
61 nb::arg(
"width"), nb::arg(
"context").none() = nb::none());
75 return IntType(context->getRef(),
78 nb::arg(
"context").none() = nb::none());
87 auto exportSMTLIB = [](MlirOperation module,
bool inlineSingleUseValues,
93 inlineSingleUseValues, indentLetBody);
95 return printAccum.
join();
96 throw nb::value_error(
97 (
"Failed to export smtlib.\nDiagnostic message " + scope.
takeMessage())
103 [&exportSMTLIB](
const PyOperation &module,
bool inlineSingleUseValues,
104 bool indentLetBody) {
105 return exportSMTLIB(module, inlineSingleUseValues, indentLetBody);
107 "module"_a,
"inline_single_use_values"_a =
false,
108 "indent_let_body"_a =
false);
111 [&exportSMTLIB](
PyModule &module,
bool inlineSingleUseValues,
112 bool indentLetBody) {
114 inlineSingleUseValues, indentLetBody);
116 "module"_a,
"inline_single_use_values"_a =
false,
117 "indent_let_body"_a =
false);
125 m.doc() =
"MLIR SMT Dialect";
NB_MODULE(_mlirDialectsSMT, m)
MlirOperation mlirModuleGetOperation(MlirModule module)
MlirContext mlirOperationGetContext(MlirOperation op)
MLIR_CAPI_EXPORTED MlirType mlirSMTTypeGetBitVector(MlirContext ctx, int32_t width)
Creates a smt::BitVectorType with the given width.
MLIR_CAPI_EXPORTED MlirStringRef mlirSMTBoolTypeGetName(void)
MLIR_CAPI_EXPORTED MlirType mlirSMTTypeGetInt(MlirContext ctx)
Creates a smt::IntType.
MLIR_CAPI_EXPORTED bool mlirSMTTypeIsABool(MlirType type)
Checks if the given type is a smt::BoolType.
MLIR_CAPI_EXPORTED bool mlirSMTTypeIsAInt(MlirType type)
Checks if the given type is a smt::IntType.
MLIR_CAPI_EXPORTED MlirType mlirSMTTypeGetBool(MlirContext ctx)
Creates a smt::BoolType.
MLIR_CAPI_EXPORTED MlirStringRef mlirSMTIntTypeGetName(void)
MLIR_CAPI_EXPORTED MlirStringRef mlirSMTBitVectorTypeGetName(void)
MLIR_CAPI_EXPORTED bool mlirSMTTypeIsABitVector(MlirType type)
Checks if the given type is a smt::BitVectorType.
RAII scope intercepting all diagnostics into a string.
std::string takeMessage()
ReferrentTy * get() const
Used in function arguments when None should resolve to the current context manager set instance.
nanobind::class_< BoolType, PyType > ClassTy
static void bind(nanobind::module_ &m)
bool(*)(MlirType) IsAFunctionTy
static bool mlirLogicalResultIsSuccess(MlirLogicalResult res)
Checks if the given logical result represents a success.
MLIR_CAPI_EXPORTED MlirLogicalResult mlirTranslateOperationToSMTLIB(MlirOperation, MlirStringCallback, void *userData, bool inlineSingleUseValues, bool indentLetBody)
static void populateDialectSMTSubmodule(nanobind::module_ &m)
Include the generated interface declarations.
A logical result value, essentially a boolean with named states.
A pointer to a sized fragment of a string, not necessarily null-terminated.
Accumulates into a python string from a method that accepts an MlirStringCallback.
MlirStringCallback getCallback()
static constexpr const char * pyClassName
static void bindDerived(ClassTy &c)
static constexpr IsAFunctionTy isaFunction
static const MlirStringRef name
static constexpr IsAFunctionTy isaFunction
static void bindDerived(ClassTy &c)
static const MlirStringRef name
static constexpr const char * pyClassName
static void bindDerived(ClassTy &c)
static constexpr const char * pyClassName
static constexpr IsAFunctionTy isaFunction
static const MlirStringRef name