22using namespace nanobind::literals;
45 nb::arg(
"context").none() = nb::none());
65 nb::arg(
"width"), nb::arg(
"context").none() = nb::none());
81 return IntType(context->getRef(),
84 nb::arg(
"context").none() = nb::none());
93 auto exportSMTLIB = [](MlirOperation module,
bool inlineSingleUseValues,
94 bool indentLetBody,
bool emitReset) {
99 inlineSingleUseValues, indentLetBody, emitReset);
101 return printAccum.
join();
102 throw nb::value_error(
103 (
"Failed to export smtlib.\nDiagnostic message " + scope.
takeMessage())
109 [&exportSMTLIB](
const PyOperation &module,
bool inlineSingleUseValues,
110 bool indentLetBody,
bool emitReset) {
111 return exportSMTLIB(module, inlineSingleUseValues, indentLetBody,
114 "module"_a,
"inline_single_use_values"_a =
false,
115 "indent_let_body"_a =
false,
"emit_reset"_a =
true);
118 [&exportSMTLIB](
PyModule &module,
bool inlineSingleUseValues,
119 bool indentLetBody,
bool emitReset) {
121 inlineSingleUseValues, indentLetBody, emitReset);
123 "module"_a,
"inline_single_use_values"_a =
false,
124 "indent_let_body"_a =
false,
"emit_reset"_a =
true);
132 m.doc() =
"MLIR SMT Dialect";
NB_MODULE(_mlirDialectsSMT, m)
MlirOperation mlirModuleGetOperation(MlirModule module)
MlirContext mlirOperationGetContext(MlirOperation op)
MLIR_CAPI_EXPORTED MlirTypeID mlirSMTIntTypeGetTypeID(void)
MLIR_CAPI_EXPORTED MlirType mlirSMTTypeGetBitVector(MlirContext ctx, int32_t width)
Creates a smt::BitVectorType with the given width.
MLIR_CAPI_EXPORTED MlirTypeID mlirSMTBitVectorTypeGetTypeID(void)
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 MlirTypeID mlirSMTBoolTypeGetTypeID(void)
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)
MlirTypeID(*)() GetTypeIDFunctionTy
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, bool emitReset)
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 constexpr GetTypeIDFunctionTy getTypeIdFunction
static const MlirStringRef name
static constexpr IsAFunctionTy isaFunction
static constexpr GetTypeIDFunctionTy getTypeIdFunction
static void bindDerived(ClassTy &c)
static const MlirStringRef name
static constexpr const char * pyClassName
static void bindDerived(ClassTy &c)
static constexpr GetTypeIDFunctionTy getTypeIdFunction
static constexpr const char * pyClassName
static constexpr IsAFunctionTy isaFunction
static const MlirStringRef name